<xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!–漸變–>
<gradient
android:startColor="@android:color/white"
android:centerColor="@android:color/black"
android:endColor="@android:color/black"
android:useLevel="true"
android:angle="45"
android:type="radial"
android:centerX="0"
android:centerY="0"
android:gradientRadius="90"/>
<!–圓角–>
<corners
android:radius="9dp"
android:topLeftRadius="2dp"
android:topRightRadius="2dp"
android:bottomLeftRadius="2dp"
android:bottomRightRadius="2dp"/><!–設(shè)置圓角半徑–>
<!–間隔–>
<padding
android:left="2dp"
android:top="2dp"
android:right="2dp"
android:bottom="2dp"/><!–各方向的間隔–>
<!–大小–>
<size
android:width="50dp"
android:height="50dp"/><!–寬度和高度–>
<!–填充–>
<solid
android:color="@android:color/white"/><!–填充的顏色–>
<!–描邊–>
<stroke
android:width="2dp"
android:color="@android:color/black"
android:dashWidth="1dp"
android:dashGap="2dp"/>
</shape–>
填充:設(shè)置填充的顏色
間隔:設(shè)置四個方向上的間隔
大小:設(shè)置大小
圓角:同時設(shè)置五個屬性,則Radius屬性無效
android:Radius="20dp"?????????????????????????? 設(shè)置四個角的半徑
android:topLeftRadius="20dp"????????????? 設(shè)置左上角的半徑
android:topRightRadius="20dp"?????????? 設(shè)置右上角的半徑
android:bottomLeftRadius="20dp"????? 設(shè)置右下角的半徑
android:bottomRightRadius="20dp"??? 設(shè)置左下角的半徑
描邊:dashWidth和dashGap屬性,只要其中一個設(shè)置為0dp泳秀,則邊框?yàn)閷?shí)現(xiàn)邊框
android:width="20dp"?????????????????????????????? 設(shè)置邊邊的寬度
android:color="@android:color/black"? 設(shè)置邊邊的顏色
android:dashWidth="2dp"???????????????????????? 設(shè)置虛線的寬度
android:dashGap="20dp"????????????????????????? 設(shè)置虛線的間隔寬度
漸變:當(dāng)設(shè)置填充顏色后,無漸變效果熏迹。angle的值必須是45的倍數(shù)(包括0)船响,僅在type="linear"有效膜宋,不然會報(bào)錯受啥。android:useLevel 這個屬性不知道有什么用做个。
angle對應(yīng)值的起點(diǎn)如圖: