FrameLayout佈局:
單幀佈局在新定義組件的時候永遠會將組件放置在屏幕的左上角,即使在此佈局中定義多個組件,後一個組件總會將前一個組件所覆蓋,除非後一個組件是透明的。
代碼如下:
<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"
>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="button1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="button2"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button3"
/>
</FrameLayout>
運行如下: