安卓學習筆記(八)、FrameLayout

1、fill_parent和match_parent,在android2.2中,fill_parent無效。

2、框架佈局是最簡單的佈局方式,所有添加到這個佈局中的視圖都是以層疊的方式顯示。第一個添加到框架佈局中的視圖顯示在最底層,最後一個唄放在最頂層,上一層的視圖會覆蓋下一層的視圖,因此框架佈局類似堆棧佈局。

3、常用屬性

top:將視圖放到屏幕最頂端

Buttom 將視圖放到屏幕最底端

                Left   將視圖放在屏幕左側

                Right  將視圖放在屏幕的右側

               Center_vertical   將視圖按照垂直方向居中顯示。

               horizontal_vertical   將視圖按照水平方向居中顯示。


4、

<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" >

    <ImageView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:background="@drawable/background" />

    <ImageView
        android:layout_width="63dp"
        android:layout_height="46dp"
        android:layout_gravity="center"
        android:layout_marginTop="80dp"
        android:background="@drawable/bird" />

    <ImageView
        android:layout_width="85dp"
        android:layout_height="85dp"
        android:layout_gravity="center"
        android:layout_marginBottom="80dp"
        android:background="@drawable/superman" />

</FrameLayout>


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