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


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值