android基礎之FrameLayout佈局

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>

運行如下:

wKiom1OmRxeS2JCGAAEtUCi8lOo493.jpg


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章