1.ProgressBar的进度条颜色变更
使用indeterminateTint属性即可
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminateTint="@color/blue" />
原来是一个粉色的,现在变成了蓝色
2.SeekBar的滑块样式和进度条颜色控制
<SeekBar
android:id="@+id/mSeekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progressDrawable="@drawable/progress_style"
android:thumb="@drawable/thumb_style" />
滑块样式设置(thumb_style.xml)
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"
android:useLevel="false">
<solid android:color="@color/colorWhite"></solid> <!-- 颜色-->
<size
android:width="12dp"
android:height="12dp"></size>
</shape>
进度条颜色设置(progress_style.xml)
这里说明一下item的id名称代表含义:
background:代表进度条的背景颜色
secondaryProgress:代表缓冲进度条的颜色(这里我没有用到)
progress:代表进度条的颜色
<?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="#54000000"/><!--前两位代表颜色透明度-->
</shape>
</item>
<!-- <item android:id="@android:id/secondaryProgress">-->
<!-- <clip>-->
<!-- <shape>-->
<!-- <solid android:color="#f9062a"/>-->
<!-- </shape>-->
<!-- </clip>-->
<!-- </item>-->
<item android:id="@android:id/progress">
<clip>
<shape>
<solid android:color="@color/blue"/>
</shape>
</clip>
</item>
</layer-list>
效果图