欢迎大家访问我的博客http://blog.youkuaiyun.com/mikejaps,专注于android ios app 开发
很多人喜欢叫此文 为 自定义seekbar,个人感觉称之为 xml 修改seekbar 式样 更合适,毕竟我们只是修改了一些属性,这些都是google 提供给我们设置的
效果如图:
<?xml version="1.0" encoding="utf-8"?>
02.<resources>
03. <style name="Widget.SeekBar.Normal" parent="@android:style/Widget.SeekBar">
04. <item name="android:maxHeight">8.0dip</item>
05. <item name="android:indeterminateOnly">false</item>
06. <item name="android:indeterminateDrawable">@android:drawable/progress_indeterminate_horizontal</item>
07. <item name="android:progressDrawable">@drawable/seekbar_horizontal</item>
08. <item name="android:minHeight">8.0dip</item>
09. <item name="android:thumb">@drawable/seek_thumb</item>
10. <item name="android:thumbOffset">10.0dip</item>
11. </style>
12.
13.
14.</resources>
<?xml version="1.0" encoding="UTF-8"?>
02.<layer-list
03. xmlns:android="http://schemas.android.com/apk/res/android">
04. <item android:id="@android:id/background" android:drawable="@drawable/seek_bkg" />
05. <item android:id="@android:id/secondaryProgress">
06. <clip>
07. <shape>
08. <corners android:radius="2.0dip" />
09. <gradient android:startColor="#80ffd300" android:endColor="#a0ffcb00" android:angle="270.0" android:centerY="0.75" android:centerColor="#80ffb600" />
10. </shape>
11. </clip>
12. </item>
13. <item android:id="@android:id/progress">
14. <clip android:drawable="@drawable/seek" />
15. </item>
16.</layer-list>
<SeekBar android:id="@+android:id/progresss"
02. android:layout_width="fill_parent" android:layout_height="wrap_content"
03. android:layout_marginTop="50dip" style="@style/Widget.SeekBar.Normal" />
<SeekBar android:id="@+android:id/progresss"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_marginTop="50dip" style="@style/Widget.SeekBar.Normal" />
seek.9.png
seek_bkg.9.png
seek_thumb.png