自定义progressDrawable
progress_drawable.xml放到drawable文件夹下面
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@android:id/background">
<shape
android:shape="rectangle" android:padding = "5dp">
<solid android:color="@android:color/transparent"/>
<stroke android:color="#16B529" android:width="1dp" />
<corners
android:bottomRightRadius="50dp"
android:bottomLeftRadius="50dp"
android:topLeftRadius="50dp"
android:topRightRadius="50dp"/>
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape
android:shape="rectangle" android:padding = "5dp">
<solid android:color="#16B529"/>
<corners
android:bottomRightRadius="50dp"
android:bottomLeftRadius="50dp"
android:topLeftRadius="50dp"
android:topRightRadius="50dp"/>
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
<shape
android:shape="rectangle" android:padding = "5dp">
<solid android:color="#16B529"/>
<corners
android:bottomRightRadius="0dp"
android:bottomLeftRadius="50dp"
android:topLeftRadius="50dp"
android:topRightRadius="0dp"/>
</shape>
</clip>
</item>
</layer-list>
在layout文件中使用自定义的progressBarDrawable
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="62dp"
android:layout_height="26dp"
android:max="100"
android:progress="80"
android:secondaryProgress="100"
android:layout_marginLeft="20dp"
android:layout_marginRight="8dp"
android:progressDrawable="@drawable/progress_drawable" />