在布局中添加如下属性,即可解决thumb指示器白边问题
<SeekBar
....
android:splitTrack="false"
/>
自定义SeekBar的样式,要处理指示器(thumb)、进度条(progressDrawable)
<SeekBar
android:id="@+id/seekbar"
android:layout_width="600dp"
android:layout_height="wrap_content"
android:maxHeight="6dp"
android:minHeight="6dp"
android:max="2"
android:background="@null"
android:splitTrack="false"
app:layout_constraintLeft_toLeftOf="@id/tv_systemSetting"
app:layout_constraintTop_toBottomOf="@id/fontSmall"
android:layout_marginTop="@dimen/dp_10"
android:thumb="@drawable/ic_seekbar_thumb"
android:progressDrawable="@drawable/seekbar_progress" />
thumb
可以自定义shape,也可以直接使用切好的图标素材
progressDrawable
seekbar_progress.xml 进度条
<?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>
<solid android:color="@color/color_dedede" />
<corners android:radius="10dp"/>
</shape>
</item>
<!--进度条颜色-->
<item android:id="@android:id/progress" >
<clip>
<shape>
<solid android:color="@color/color_0A2EC1" />
<corners android:radius="10dp"/>
</shape>
</clip>
</item>
</layer-list>