Frame layouts are the simplest way to lay out, and all views added to this layout are displayed in a cascading manner, with the first view added to the layout displayed at the bottom, the last one placed on top, and the previous view covering the next layer of view. The framework is similar to a stack layout. By default, components are placed in the upper-left corner.
One, copy several pictures to the/RES/DRAWABLE-HPDI directory
<framelayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http// Schemas.android.com/tools "android:layout_width=" match_parent "android:layout_height=" Match_parent "Android:paddi ngbottom= "@dimen/activity_vertical_margin" android:paddingleft= "@dimen/activity_horizontal_margin" Android: paddingright= "@dimen/activity_horizontal_margin" android:paddingtop= "@dimen/activity_vertical_margin" tools: Context= ". Mainactivity "><imageview android:layout_width=" match_parent "android:layout_height=" Wrap_content "Android: layout_gravity= "center" android:background= "@drawable/bg"/><imageview android:layout_width= "63DP" Android: layout_height= "46DP" android:layout_gravity= "center" android:layout_margintop= "80DP" android:background= "@drawabl E/girl "/><imageview android:layout_width=" 100DP "android:layout_height=" 100DP "android:layout_gravity=" cen ter "android:layout_marginbottom=" 80DP "android:background= "@drawable/test"/></framelayout>
You can see the first picture in turn BG because in the use ofThe layout_gravity property, so the mid-level display
the second picture of Girl is not set to alignment, so the default in the upper left corner, the third picture test is aligned to the middle, but because of the extra Layout_marginbottom, on the distance, the content is 80DP.
Android--framelayout layout