005帧布局管理器

1.      后面的组件会覆盖前面的组件,默认从左上角开始

2.      FrameLayou主要两个属性,foreground和foregroundGravity

foreground设置布局前景图像(始终位于最上层的图像)

foregroundGravity设置前景图像位置的(center之类的值,多个则用|隔开)

3.      为前景图像设置显示位置后(设置foregroundGravidy后),图像就会按照原来的大小显示,不然就是图像是整个页面那么大

 

代码


<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:foreground="@mipmap/img1"
    android:foregroundGravity="right|bottom"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">
    
    <TextView
        android:layout_width="280dp"
        android:layout_height="280dp"
        android:layout_gravity="center"
        android:background="#ff0000ff"
        android:text="蓝色背景的textview"
        android:textColor="#ffffff"/>

    <TextView
        android:layout_width="230dp"
        android:layout_height="230dp"
        android:layout_gravity="center"
        android:background="#0077ff"
        android:text="天蓝色背景的textview"
        android:textColor="#ffffff"/>

    <TextView
        android:layout_width="180dp"
        android:layout_height="180dp"
        android:layout_gravity="center"
        android:background="#ff00b4ff"
        android:text="水蓝色背景的textview"
        android:textColor="#ffffff"/>


</FrameLayout>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值