I read many SO topics and other tutorials, but I did not get answer for this question:
What is right way to stylize(customize) standard SeekBar ? (a namely: set size(height) and color to progress line and thumb)
I found two way to realize this:
- Create .png(or .9.png) for progress line and thumb and use it.
- Create .xml in drawable. In .xml create layer-list, in layer-list item-shape.
__
One people says, use first way, other says - use second way.
What the right way? Might have a good third way?
__
I try second way, but can not understand, how can I specify my size(height) for progress and secondary progress. How can I do this?
What I want:
My SeekBar:
<SeekBar
android:layout_width="306dp"
android:layout_height="wrap_content"
android:progressDrawable="@drawable/seek_bar_progress"
android:thumb="@drawable/seek_bar_thumb"/>
seek_bar_progress.xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape android:shape="rectangle">
<solid android:color="#FFFFFF" />
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<shape android:shape="rectangle">
<solid android:color="#FFFFFF" />
</shape>
</item>
<item android:id="@android:id/progress">
<shape android:shape="rectangle">
<solid android:color="#0000FF" />
</shape>
</item>
</layer-list>
seek_bar_thumb.xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item >
<shape android:shape="oval">
<solid android:color="#0000FF"/>
<size android:height="31dp" android:width="31dp"/>
</shape>
</item>
</layer-list>