效果圖

Paste_Image.png
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:innerRadiusRatio="3"
android:shape="ring"
android:thicknessRatio="9"
android:useLevel="false">
<gradient
android:endColor="#2F90BD"
android:startColor="#19a669"
android:type="sweep" />
<stroke
android:width="0dp"
android:color="@android:color/black" />
</shape>
shape根元素有些屬性只適用于ring類型:
android:innerRadius 內(nèi)環(huán)的半徑
android:innerRadiusRatio 浮點(diǎn)型,以環(huán)的寬度比率來(lái)表示內(nèi)環(huán)的半徑,默認(rèn)為3,表示內(nèi)環(huán)半徑為環(huán)的寬度除以3,該值會(huì)被android:innerRadius覆蓋
android:thickness 環(huán)的厚度
android:thicknessRatio 浮點(diǎn)型,以環(huán)的寬度比率來(lái)表示環(huán)的厚度,默認(rèn)為9,表示環(huán)的厚度為環(huán)的寬度除以9,該值會(huì)被android:thickness覆蓋
android:useLevel 一般為false,否則可能環(huán)形無(wú)法顯示,只有作為L(zhǎng)evelListDrawable使用時(shí)才設(shè)為true