Customize the beautiful Android Seekbar style

Source: Internet
Author: User

System comes with the Seekbar is really ugly, the project needs, can only be customized, first come to Zhang

The first Seekbar background is the color, thumb is the picture, on the code:

[HTML]View Plaincopy
  1. <SeekBar
  2. android:id="@+id/timeline"
  3. android:layout_width="fill_parent"
  4. android:layout_height="wrap_content"
  5. android:focusable="true"
  6. android:maxheight="4.0dip"
  7. android:minheight="4.0dip"
  8. android:paddingleft="16.0dip"
  9. android:paddingright="16.0dip"
  10. android:progressdrawable="@drawable/po_seekbar"
  11. android:thumb="@drawable/seekbar_thumb" />

Drawable/po_seekbar.xml:

[HTML]View Plaincopy
  1. <? XML version= "1.0" encoding="Utf-8"?>
  2. <layer-list
  3. xmlns:android="http://schemas.android.com/apk/res/android">
  4. <item android:id="@*android:id/background">
  5. <shape>
  6. <solid android:color="#ff51495e" />
  7. </shape>
  8. </Item>
  9. <item android:id="@*android:id/secondaryprogress">
  10. <clip>
  11. <shape>
  12. <solid android:color="#ff51495e" />
  13. </shape>
  14. </clip>
  15. </Item>
  16. <item android:id="@*android:id/progress">
  17. <clip>
  18. <shape>
  19. <solid android:color="#ff996dfe" />
  20. </shape>
  21. </clip>
  22. </Item>
  23. </layer-list>

Drawable/seekbar_thumb.xml:

[HTML]View Plaincopy
  1. <? XML version= "1.0" encoding="Utf-8"?>
  2. <selector
  3. xmlns:android="http://schemas.android.com/apk/res/android">
  4. <item android:state_focused="true" android:state_pressed="false" android:drawable= "@drawable/seekbar_thumb_normal" />
  5. <item android:state_focused="true" android:state_pressed="true" Android: drawable="@drawable/seekbar_thumb_pressed" />
  6. <item android:state_focused="false" android:state_pressed="true" android:drawable= "@drawable/seekbar_thumb_pressed" />
  7. <item android:drawable="@drawable/seekbar_thumb_normal" />
  8. </selector>


Seekbar_thumb_pressed.png:

Seekbar_thumb_normal.png:

The 2nd and 3rd Seekbar are all picture implementations.

[HTML]View Plaincopy
  1. <SeekBar
  2. android:id="@+id/sb_detail_play_progress"
  3. android:layout_width="fill_parent"
  4. android:layout_height="wrap_content"
  5. android:layout_centervertical="true"
  6. android:layout_gravity="center"
  7. android:paddingleft="15.0dip"
  8. android:paddingright="15.0dip"
  9. android:progressdrawable="@drawable/progress_holo_light"
  10. android:thumb="@drawable/detail_icon_schedule_ball" />


Drawable/progress_holo_light.xml:

[HTML]View Plaincopy
  1. <? XML version= "1.0" encoding="Utf-8"?>
  2. <layer-list
  3. xmlns:android="http://schemas.android.com/apk/res/android">
  4. <item android:id= "@*android:id/background" android:drawable="@drawable/volumn_bg" />
  5. <item android:id="@*android:id/secondaryprogress">
  6. <scale android:drawable= "@drawable/volumn_front" android:scalewidth="100%" />
  7. </Item>
  8. <item android:id="@*android:id/progress">
  9. <scale android:drawable= "@drawable/volumn_primary" android:scalewidth="100%" />
  10. </Item>
  11. </layer-list>

Volumn_bg.9.png

Volumn_front.9.png


Volumn_primary.png


3rd One Seekbar

Here's a picture.

Demo Download Link: http://download.csdn.net/detail/w8320273/7800859

Customize the beautiful Android 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: info-contact@alibabacloud.com 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.