目錄
1、自定義進(jìn)度條樣式
2、自定義滑塊樣式
1、自定義進(jìn)度條樣式
一、方式一
咱們還能夠找到 .xml的內(nèi)容,大體以下,咱們只須要對該內(nèi)容進(jìn)行修改便可以改變進(jìn)度條的背景顏色以及進(jìn)度條的顏色了。web
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

<item android:id="@android:id/background">
<shape>
<corners android:radius="10dip" />
<gradient android:startColor="#ff9d9e90" android:centerColor="#ff5a5d5a" android:centerY="0.75" android:endColor="#ff747674" android:angle="270" />
shape>
item>

<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners android:radius="10dip" />
<gradient android:startColor="#50ff0000" android:centerColor="#50ff0000" android:centerY="0.75" android:endColor="#a0ffcb00" android:angle="270" />
shape>
clip>
item>

<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="5dip" />
<gradient android:startColor="#ffff0000" android:centerColor="#ffff0000" android:centerY="0.75" android:endColor="#ffffcb00" android:angle="270" />
shape>
clip>

item>
layer-list>
二、方式二
咱們也能夠本身制做進(jìn)度條圖片android進(jìn)度條修改顏色,經(jīng)過的屬性進(jìn)行調(diào)用使用便可。svg
android:progressDrawable="@drawable/color"
2、自定義滑塊樣式
這里咱們新建一個(gè)xml文件經(jīng)過設(shè)定它的狀態(tài)來改變圖片便可android進(jìn)度條修改顏色,再在中經(jīng)過thumb屬性進(jìn)行調(diào)用便可。
xml文件spa
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/list_btn_radio_check_on" android:state_focused="true" android:state_window_focused="true">item>
<item android:drawable="@drawable/list_btn_radio_check_on" android:state_selected="true" android:state_window_focused="true">item>
<item android:drawable="@drawable/list_btn_radio_check_on" android:state_pressed="true" android:state_window_focused="true">item>
<item android:drawable="@drawable/list_btn_radio_check_off" >item>
selector>
調(diào)用code
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" android:orientation="vertical"> <SeekBar android:id="@+id/seekbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:max="100" android:progress="30" /> <SeekBar android:id="@+id/seekbar2" android:layout_width="match_parent" android:layout_height="wrap_content" android:max="100" android:progress="30" android:thumb="@drawable/seekbarimg" /> <SeekBar android:id="@+id/seekbar2" android:layout_width="match_parent" android:layout_height="wrap_content" android:max="100" android:progress="30" android:progressDrawable="@drawable/color" android:thumb="@drawable/seekbarimg" LinearLayout>