Android 中clipToPadding 和 clipChildren區(qū)別和作用
Android 中clipToPadding 和 clipChildren區(qū)別和作用
Android 關(guān)于 clipToPadding 和 clipChildren區(qū)別和作用對于這兩個屬性那也是很神奇,
1.對于clipToPadding 默認(rèn)是true, 這個屬性一般都是viewgrounp對象才會用到, 他的意思就是 對于padding 所占的尺寸大小也繪制 其他的item的view,
2.對于clipChildren 默認(rèn)是true,這個屬性是讓子view不受父view大小的限制,可以超過父view的寬高,延伸到周圍view內(nèi)部
下面放入效果圖:
第一個布局是:viewpager 讓兩邊的縮進(jìn)的同時讓其他的也顯示一部分,這種效果,就會用到 clipToPadding = false屬性
這個布局就用到了clipChildren = false,能讓flatbutton從上面布局延伸到周圍的布局內(nèi)部而不被覆蓋,例如下面的布局也是
以上基本都是這兩個屬性的區(qū)別;例子
<?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>
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
相關(guān)文章
Android Studio 配置忽略文件的方法實(shí)現(xiàn)
這篇文章主要介紹了Android Studio 配置忽略文件的方法實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-10-10Android串口開發(fā)之使用JNI實(shí)現(xiàn)ANDROID和串口通信詳解
這篇文章主要給大家介紹了關(guān)于Android串口開發(fā)之使用JNI實(shí)現(xiàn)ANDROID和串口通信的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧。2018-01-01Android自定義View實(shí)現(xiàn)折線圖效果
這篇文章介紹的是一個折線圖控件,用來顯示一系列的狀態(tài),并可以進(jìn)行滑動。有需要的可以參考借鑒。2016-08-08Android使用ViewPager實(shí)現(xiàn)翻頁效果
這篇文章主要為大家詳細(xì)介紹了Android使用ViewPager實(shí)現(xiàn)翻頁效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2022-05-05Android miniTwitter登錄界面開發(fā)實(shí)例
這篇文章主要為大家詳細(xì)介紹了Android miniTwitter登錄界面開發(fā)實(shí)例,感興趣的小伙伴們可以參考一下2016-04-04利用Kotlin的協(xié)程實(shí)現(xiàn)簡單的異步加載詳解
這篇文章主要給大家介紹了關(guān)于利用Kotlin的協(xié)程實(shí)現(xiàn)簡單的異步加載的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧。2018-03-03