1.使用
<SeekBar
android:id="@+id/videoSeekBar"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:progressDrawable="@drawable/player_setting_bright_progressbar"
android:thumb="@drawable/player_settings_bright_thumb" />
2.属性介绍
android:progressDrawable //进度条样式
android:thumb //拖动图标样式
3.进度条样式修改
新建player_setting_bright_progressbar.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" android:drawable="@drawable/setting_bright_seekbar_background" />
<!-- 第二进度条的背景色 -->
<item android:id="@android:id/secondaryProgress" >
<scale android:drawable="@color/seekbar_second" android:scaleWidth="100%" />
</item>
<!-- 可拖动的进度条颜色 -->
<item android:id="@android:id/progress">
<scale android:drawable="@drawable/setting_bright_seekbar_progress" android:scaleWidth="100%" />
</item>
</layer-list>
4.修改拖动的图标
新建player_settings_bright_thumb.xml文件
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/seekbar_thumb_normal" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/seekbar_thumb_pressed" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/seekbar_thumb_pressed" />
<item android:drawable="@drawable/seekbar_thumb_normal" />
</selector>