1. seekbar in the layout file:
(Progress bar style Android: progressdrawable = "@ drawable/seekbar_bg ")
(Drag the Android: thumb = "@ drawable/thumb_bar" button to configure the style, such as press status ;)
<SeekBar android:id="@+id/my_seekBar" android:layout_width="300dp" android:layout_height="20dp" android:max="100" android:minHeight="10dp" android:maxHeight="10dp" android:paddingLeft="8dp" android:paddingRight="8dp" android:thumbOffset="5dp" android:layout_centerVertical="true" android:progressDrawable="@drawable/seekbar_bg" android:thumb="@drawable/thumb" /><pre class="html" name="code">
<PRE class = "html" name = "code"> 2. Configure seekbar_bg.xml in the progress bar style file:
<? XML version = "1.0" encoding = "UTF-8"?> <Layer-list xmlns: Android = "http://schemas.android.com/apk/res/android"> <! -- Progress Bar background --> <item Android: Id = "@ + Android: ID/background"> <nine-patch Android: src = "@ drawable/bar_dn"/> </item> <! -- Second Progress --> <item Android: Id = "@ + Android: ID/secondaryprogress"> <nine-patch Android: src = "@ drawable/bar_dn"/> </item> <! -- Progress --> <item Android: Id = "@ + Android: ID/progress"> <clip> <nine-patch Android: src = "@ drawable/bar_up"/> </clip> </item> </layer-List>
---- The above figure uses the. 9 configuration. If you use the image directly, you can directly configure it as follows:
<layer-list> <item android:id="@+android:id/background" android:drawable="@drawable/bar_dn" /><item android:id="@+android:id/SecondaryProgress" android:drawable="@drawable/bar_dn" /><item android:id="@+android:id/progress" android:drawable="@drawable/bar_up" /></layer-list>
3. Drag the button Android: thumb = "@ drawable/thumb" (in the white point)
Schedule .9image (suffixed with .9.png)
Bar_dn.9.png
Bar_up.9.png
Use the. 9 chart to change the seekbar Style