<SeekBar
android:id="@+id/sb_air_conditioning"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="36dp"
android:layout_marginRight="36dp"
android:max="14"
android:maxHeight="2dp"
android:minHeight="2dp"
android:progress="7"
android:progressDrawable="@drawable/seekbar_brightness_style"
android:thumb="@drawable/ic_adjustthecircle"
app:layout_constraintTop_toBottomOf="@id/tv_temperature" />
进度条: android:progressDrawable="@drawable/seekbar_brightness_style"
滑块: android:thumb="@drawable/ic_adjustthecircle"
seekbar_brightness_style 重点在进度条,要被坑死了,一开始写的 background +progress ,中间改过几次。底色条一直出不来,加了secondaryProgress底色条才没有被覆盖。故写background+secondaryProgress即可。
<?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:drawable="@drawable/ic_brightnesscontrolline">-->
<!-- <clip>-->
<shape>
<corners android:radius="2dp" />
<solid android:color="@color/grey" />
</shape>
<!--</clip>-->
</item>
<!-- 第二进度条式样 -->
<!--进度条颜色设置为-->
<item android:id="@android:id/secondaryProgress">
<!-- android:drawable="@drawable/ic_blue_line">-->
<clip>
<shape>
<corners android:radius="2dp" />
<solid android:color="@color/colorAccent" />
</shape>
</clip>
</item>
<!--进度条颜色设置为-->
<!-- <item android:id="@android:id/progress">
<!– android:drawable="@drawable/ic_blue_line">–>
<clip>
<shape>
<corners android:radius="2dp" />
<solid android:color="@color/colorAccent" />
</shape>
</clip>
</item>-->
</layer-list>