Home » Android » Android- uses the middle of the frame layout manag...

Android- uses the middle of the frame layout manager to display the stacked squares

framework layout manager said, in the layout manager, each adding a component that will create a blank area, often referred to as a frame, the frame will be based on the gravity attribute to perform automatic alignment. By default, the frame layout is from the upper left corner of the screen (0,0) began the layout of the coordinate points of multiple components stacked sort, behind the front cover component assembly.


The common XML attribute supported by

FrameLayou is

Android:foreground: sets the foreground image
of the frame layout container
Android:foregroundgravity: defines the gravity property of the foreground image, which is the location of the foreground image,


implementation process:

In the frame layout manager, add three central display, and specify different colors and sizes for them to better reflect cascading effects,.


's modified code is as follows:


<, XML, version=, 1, encoding=, UTF-8, >
<FrameLayout xmlns:android=, "http://schemas.android.com/apk/res/android",
android:layout_width= "fill_parent"
android:layout_height= "fill_parent"
>

<TextView
android:layout_width= "280dp"
android:layout_height= "280dp"
android:background= "#004433"
android:layout_gravity= "center"
/>

<TextView
android:layout_width= "240dp"
android:layout_height= "240dp"
android:background= "#00aa00"
android:layout_gravity= "center"
/>

<TextView
android:layout_width= "200dp"
android:layout_height= "200dp"
android:background= "#00dd00"
android:layout_gravity= "center"
/>

FrameLayout>

Latest