The framelayout layout is characterized by: all view components placed in the layout are stacked hierarchically in the upper-left corner of the screen, followed by a view component that overrides the previous one.
Of course, the component itself can control its own internal layout.
A common scenario is that you can animate by placing multiple picture views on the framelayout.
Let's look at a simple example:
1. Create an App
2, create the main activity, the activity uses the Framelayout layout, the contents of the layout file are as follows:
<?xml version= "1.0" encoding= "Utf-8"?>
<framelayout xmlns:android= "Http://schemas.android.com/apk/res/android"
................
>
<button
Android:id= "@+id/button1"
Android:layout_width= "400px"
android:layout_height= "400px"
Android:background= "#888888"
/>
<button
Android:id= "@+id/button2"
Android:layout_width= "300px"
android:layout_height= "300px"
Android:background= "#555555"
/>
<button
Android:id= "@+id/button3"
Android:layout_width= "200px"
android:layout_height= "200px"
Android:background= "#222222"
/>
</FrameLayout>
3, run the app, you can see the corresponding effect. If you are using Eclipse development, you can see the same effect by looking directly at the graphical view of the layout file, as follows:
As you can see, the first button (the largest size) is on the lowest level, the 2nd button is above it, and the 3rd button is on top.
On the basis of this most basic feature, combined with the view of the hidden or transparent background and other properties, you can achieve a variety of special display methods.
Note: Do not confuse framelayout with fragment, which is completely irrelevant, the former is a layout of the view, the latter is a view component.
Android Learning Note: Framelayout Layout Basics