本篇文章给大家分享的是有关clipToPadding与clipChildren在Android 中有什么不同,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。1.对于clipToP
本篇文章给大家分享的是有关clipToPadding与clipChildren在Android 中有什么不同,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。
1.对于clipToPadding 默认是true, 这个属性一般都是viewgrounp对象才会用到, 他的意思就是 对于padding 所占的尺寸大小也绘制 其他的item的view,
2.对于clipChildren 默认是true,这个属性是让子view不受父view大小的限制,可以超过父view的宽高,延伸到周围view内部
下面放入效果图:
第一个布局是:viewpager 让两边的缩进的同时让其他的也显示一部分,这种效果,就会用到 clipToPadding = false属性
这个布局就用到了clipChildren = false,能让flatbutton从上面布局延伸到周围的布局内部而不被覆盖,例如下面的布局也是
以上基本都是这两个属性的区别;例子
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="Http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:clipChildren="false" android:orientation="vertical" > <android.support.v4.view.ViewPager android:id="@+id/view_pager" android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1.0" /> <LinearLayout android:layout_width="match_parent" android:layout_height="48dip" android:background="#B0C4DE" android:orientation="horizontal" > <ImageView android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1.0" android:scaleType="fitCenter" android:src="@drawable/ic_launcher" /> <ImageView android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1.0" android:scaleType="fitCenter" android:src="@drawable/ic_launcher" /> <ImageView 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" /> <ImageView android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1.0" android:scaleType="fitCenter" android:src="@drawable/ic_launcher" /> <ImageView android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1.0" android:scaleType="fitCenter" android:src="@drawable/ic_launcher" /> </LinearLayout></LinearLayout>
--结束END--
本文标题: clipToPadding与clipChildren在Android 中有什么不同
本文链接: https://www.lsjlt.com/news/222932.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0