Android開發(fā)手冊shape屬性和子屬性使用說明
更新時間:2022年06月11日 09:37:59 作者:芝麻粒兒
這篇文章主要為大家介紹了Android開發(fā)手冊shape屬性和子屬性使用說明,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
??shape屬性詳解
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:innerRadius="30dp"
android:innerRadiusRatio="2"
android:shape="ring"
android:thickness="2dp"
android:thicknessRatio="3"
android:useLevel="false">
</shape>- android:shape="line" shape的形狀,默認(rèn)為矩形,可以設(shè)置為矩形(rectangle)、橢圓形(oval)、線性形狀(line)、環(huán)形(ring)
- android:innerRadius 尺寸,內(nèi)環(huán)的半徑,僅是ring環(huán)形可用。
- android:innerRadiusRatio 浮點(diǎn)型,以環(huán)的寬度比率來表示內(nèi)環(huán)的半徑,比如環(huán)的寬度為50,比例為2.5,那么內(nèi)環(huán)半徑為20
- android:thickness 尺寸,環(huán)的厚度
- android:thicknessRatio 浮點(diǎn)型,以環(huán)的寬度比率來表示環(huán)的厚度,和innerRadiusRatio相似
- android:useLevel boolean值,有時必須要加上她才有效果,寫上就有效果了
??子屬性詳解
<corners //定義圓角
android:radius="10dp" //全部的圓角半徑,例:10dp
android:topLeftRadius="10dp" //左上角的圓角半徑,例:10dp
android:topRightRadius="10dp" //右上角的圓角半徑,例:10dp
android:bottomLeftRadius="10dp" //左下角的圓角半徑,例:10dp
android:bottomRightRadius="10dp" /> //右下角的圓角半徑,例:10dp
<solid android:color="#ffff00" /> //只有一個color,設(shè)置填充顏色即可。
<gradient
android:type="linear" //共有3中漸變類型,線性漸變(默認(rèn)linear)/放射漸變(radial)/掃描式漸變(sweep)
android:angle="0" //漸變角度,必須為45的倍數(shù),0為從左到右,90為從上到下 ,僅在線性漸變生效
android:centerX="0.2" //漸變中心X的相當(dāng)位置,范圍為0~1,多應(yīng)用于放射漸變
android:centerY="0.1" //漸變中心Y的相當(dāng)位置,范圍為0~1,多應(yīng)用于放射漸變
android:startColor="#ff0000" //漸變開始點(diǎn)的顏色
android:centerColor="#ffff00" //漸變中間點(diǎn)的顏色,在開始與結(jié)束點(diǎn)之間
android:endColor="#00ff00" //漸變結(jié)束點(diǎn)的顏色
android:gradientRadius="10" //漸變的半徑,只有當(dāng)漸變類型為radial時才能使用
android:useLevel="false" /> //屬性通常不使用。該屬性用于指定是否將該shape當(dāng)成一個LevelListDrawable來使用,默認(rèn)值為false。
<stroke
android:width="dimension" //表示描邊的寬度
android:color="#00ff00" //表示描邊的顏色,例綠色
android:dashWidth="8dp" //虛線的寬度,值為0時便是實(shí)線,例8dp寬
android:dashGap="1dp" /> //虛線的間隔,例間隔1dp以上就是Android開發(fā)手冊shape屬性和子屬性使用說明的詳細(xì)內(nèi)容,更多關(guān)于Android開發(fā)shape屬性子屬性的資料請關(guān)注腳本之家其它相關(guān)文章!
相關(guān)文章
Android實(shí)現(xiàn)熱門標(biāo)簽的流式布局
這篇文章主要介紹了Android實(shí)現(xiàn)熱門標(biāo)簽的流式布局的詳細(xì)方法,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2015-12-12
Android開發(fā)vsts?agent支持自定義task過程詳解
這篇文章主要介紹了Android開發(fā)vsts?agent支持自定義task過程詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步早日升職加薪2022-04-04
MotionLayout自定義開關(guān)按鈕實(shí)例詳解
這篇文章主要為大家介紹了MotionLayout自定義開關(guān)按鈕實(shí)例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-11-11
解決android有的手機(jī)拍照后上傳圖片被旋轉(zhuǎn)的問題
這篇文章主要介紹了解決android有的手機(jī)拍照后上傳圖片被旋轉(zhuǎn)的問題的相關(guān)資料,需要的朋友可以參考下2016-09-09
android 使用uinput模擬輸入設(shè)備的方法
這篇文章主要介紹了android 使用uinput模擬輸入設(shè)備的方法,有需要的朋友可以參考一下2014-01-01

