clipChildren属性

今天来安利的 是一个比较特殊的属性, 首先我们来看下图
   
红色标记的,相信大家写出来也不是很难,
 
这里安利下clipChildren 就可以很简单的写出来了,先介绍下这个属性
clipchildren :字面翻译下就是  修剪儿子  
       官方一点的解释    是否限制子View在其范围内,当我们将其值设置为false后那么在子控件的高度高于父控件时也会完全显示,而不会被压缩,(上面中间的按钮超过上面的阴影线,依旧可以正常显示),默认的时候是true,

用法看下面代码  clipchildren 放在 RelativeLayout中的
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:clipChildren="false">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="40dip"
        android:background="#B0C4DE"
        android:orientation="horizontal"
        android:layout_alignParentBottom="true">

        <ImageView
            android:layout_width="0dip"
            android:layout_height="fill_parent"
            android:layout_weight="1.0"
            android:scaleType="fitCenter"
            android:src="@mipmap/ic_launcher" />

        <ImageView
            android:layout_width="0dip"
            android:layout_height="fill_parent"
            android:layout_weight="1.0"
            android:scaleType="fitCenter"
            android:src="@mipmap/ic_launcher" />

        <ImageView
            android:layout_width="0dip"
            android:layout_height="75dip"
            android:layout_gravity="bottom"
            android:layout_weight="1.0"
            android:scaleType="fitCenter"
            android:src="@mipmap/ic_launcher" />

        <ImageView
            android:layout_width="0dip"
            android:layout_height="fill_parent"
            android:layout_weight="1.0"
            android:scaleType="fitCenter"
            android:src="@mipmap/ic_launcher" />

        <ImageView
            android:layout_width="0dip"
            android:layout_height="fill_parent"
            android:layout_weight="1.0"
            android:scaleType="fitCenter"
            android:src="@mipmap/ic_launcher" />
    </LinearLayout>

</RelativeLayout>



效果图



评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值