答案 0 :(得分:1)
尝试一下
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<SeekBar
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progressDrawable="@drawable/test"
android:thumb="@drawable/ic_send" />
</LinearLayout>
android:progressDrawable =“ @ drawable / test”
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background"
android:gravity="center_vertical|fill_horizontal">
<shape android:shape="rectangle"
android:tint="@color/colorAccent">
<corners android:radius="10dp"/>
<size android:height="10dp" />
<solid android:color="@color/colorAccent" />
</shape>
</item>
<item android:id="@android:id/progress"
android:gravity="center_vertical|fill_horizontal">
<scale android:scaleWidth="100%">
<selector>
<item android:state_enabled="false"
android:drawable="@android:color/transparent" />
<item>
<shape android:shape="rectangle"
android:tint="@color/colorPrimary">
<corners android:radius="8dp"/>
<size android:height="30dp" />
<solid android:color="@color/colorAccent" />
</shape>
</item>
</selector>
</scale>
</item>
</layer-list>
输出
注意
您可以根据需要更改 corners radius
和 android:thumb