Use the. 9 chart to change the seekbar Style

Source: Internet
Author: User


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 = ""> <! -- 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)




Use the. 9 chart to change the seekbar Style

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.