FrameLayout布局:
单帧布局在新定义组件的时候永远会将组件放置在屏幕的左上角,即使在此布局中定义多个组件,后一个组件总会将前一个组件所覆盖,除非后一个组件是透明的。
代码如下:
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="button1" /> android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="button2" /> android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button3" />
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="button1" /> android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="button2" /> android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button3" />
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="button1"
/>
android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="button2" /> android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button3" />
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="button2"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button3" />
android:text="button3"
运行如下:
上一篇:android基础之EditText
下一篇:android基础之CheckBox