Objective
As one of the simplest layouts in the Android six-part layout, the layout creates a blank area directly on the screen,
When we add components to the inside, all the components are placed in the upper-left corner of the area.
The size of the frame layout is determined by the largest child control in the control, and if all components are the same, you can only see the topmost component at the same time!
Of course, we can also add the Layout_gravity attribute to the component to develop the way the component is
The frame layout is used more in the game development aspect, later will give everybody to demonstrate the more interesting two examples
Introduction to (-) frame layouts
The Frame layout container creates a blank area for each of the joined components called a frame each subassembly occupies a frame that is automatically aligned according to Gravity's properties
(ii) Common properties:
Android:foreground: Sets the foreground image for the frame layout container
Android:foregroundgravity: Set the location where the foreground image is displayed
(iii) Use
<?xml version= "1.0" encoding= "Utf-8"?> <linearlayout xmlns:android= "http://schemas.android.com/apk/res/" Android "Android:layout_width=" Match_parent "android:layout_height=" Match_parent "> <framelayout android: Layout_width= "Match_parent" android:layout_height= "wrap_content" > <textview android:layout_width= "Wrap_con" Tent "android:layout_height=" wrap_content "android:layout_gravity=" center "android:width=" 300DP "Android:heigh t= "300DP" android:background= "#f00"/> <textview android:layout_width= "Wrap_content" android:layout_height = "Wrap_content" android:layout_gravity= "center" android:width= "200DP" android:height= "200DP" Android:backgroun d= "#0f0"/> <textview android:layout_width= "wrap_content" android:layout_height= "Wrap_content" Android:lay out_gravity= "center" android:width= "100DP" android:height= "100DP" android:background= "#00f"/> </framelayou T> </LinearLayout>
The above content to introduce the Android layout of the Framelayout frame layout, I hope you like.