FrameLayout of Android UI (frame layout)
FrameLayout of Android UI (frame layout)
Note: The frame layout opens up a blank area (referred to as a frame) for each component. These frames are stacked together layer by layer, which is somewhat similar to posters mounted on layer by layer, later components overwrite the previous components.
FrameLayout has two special common attributes:
1 android: foreground
Corresponding Method: setForeground (Drawable)
Description: sets the foreground image of the frame layout. Generally, this attribute is used to specify a Drawable object for adding the pressed state to the layout.
Example:
<framelayout android:foreground="@drawable/muogu" android:layout_height="fill_parent" android:layout_width="fill_parent">
</framelayout>
Authorization + authorization + uxs76wyau1xMewvrDJq7XE0Ke5 + 6GjPC9wPg0KPGgzIGlkPQ = "2-foregroundgravity"> 2 foregroundGravity
Corresponding Method: setForegroundGravity (int)
Note: You can see the name. It must be related to the placement of the front view. Yes, the function of this attribute is to define the gravity attribute of the foreground image, so this attribute must be used with foreground. The option gravity is the same. You can find the attribute table in my previous Android UI LinearLayout (linear layout.
Example:
<framelayout android:foreground="@drawable/muogu" android:foregroundgravity="bottom|right" android:layout_height="fill_parent" android:layout_width="fill_parent">
</framelayout>
The only difference between the above Code is that the following line of code is added to FrameLayout.
android:foregroundGravity=bottom|right
As you can see, the foreground image is restored to the original size and placed in the lower right corner according to the settings. As a result, the child components in FrameLayout are displayed.