安卓学习笔记(八)、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>


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