android cliptopadding java代码_Android 中clipToPadding 和 clipChildren区别和作用

Android 中clipToPadding 和 clipChildren区别和作用

Android 关于 clipToPadding和 clipChildren区别和作用对于这两个属性那也是很神奇,

1.对于clipToPadding 默认是true, 这个属性一般都是viewgrounp对象才会用到, 他的意思就是 对于padding 所占的尺寸大小也绘制 其他的item的view,

2.对于clipChildren 默认是true,这个属性是让子view不受父view大小的限制,可以超过父view的宽高,延伸到周围view内部

下面放入效果图:

3362d2968b6e1ac4d4a50ff190ec2463.png

第一个布局是:viewpager 让两边的缩进的同时让其他的也显示一部分,这种效果,就会用到 clipToPadding = false属性

d5c14ffc13de5edd0df108567d1b29ba.png

这个布局就用到了clipChildren = false,能让flatbutton从上面布局延伸到周围的布局内部而不被覆盖,例如下面的布局也是

8d3a15ea9ba5f5987ca4be03333f664b.png

以上基本都是这两个属性的区别;例子

android:layout_width="match_parent"

android:layout_height="match_parent"

android:clipChildren="false"

android:orientation="vertical" >

android:id="@+id/view_pager"

android:layout_width="match_parent"

android:layout_height="0dip"

android:layout_weight="1.0" />

android:layout_width="match_parent"

android:layout_height="48dip"

android:background="#B0C4DE"

android:orientation="horizontal" >

android:layout_width="0dip"

android:layout_height="fill_parent"

android:layout_weight="1.0"

android:scaleType="fitCenter"

android:src="@drawable/ic_launcher" />

android:layout_width="0dip"

android:layout_height="fill_parent"

android:layout_weight="1.0"

android:scaleType="fitCenter"

android:src="@drawable/ic_launcher" />

android:layout_width="0dip"

android:layout_height="64dip"

android:layout_gravity="bottom"

android:layout_weight="1.0"

android:scaleType="fitCenter"

android:src="@drawable/ic_launcher" />

android:layout_width="0dip"

android:layout_height="fill_parent"

android:layout_weight="1.0"

android:scaleType="fitCenter"

android:src="@drawable/ic_launcher" />

android:layout_width="0dip"

android:layout_height="fill_parent"

android:layout_weight="1.0"

android:scaleType="fitCenter"

android:src="@drawable/ic_launcher" />

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值