(Figure I) (figure II) (figure III)
Make a custom Seekbar and change its background image:
[Java]View PlainCopy
- <com.android.progress
- android:id="@+id/focus_seekbar"
- Android:layout_width="Wrap_content"
- android:layout_height="Wrap_content"
- android:layout_below="@id/seekbar_add"
- android:progressdrawable="@drawable/seekbar_img"
- android:thumb="@drawable/thumb"
- Android:max = "/> "
The definition progressdrawable is the background picture. Thumb as Slider picture
As on the definition XML file, start the program, generate one. The Thumb slider cannot be displayed completely, and part of it is hidden away.
To add a property:
[Java]View PlainCopy
- android:thumboffset="0dip"
You can realize that the thumb is not overwritten, that is, the bottom position is three, there is no picture.
There is a vertical verticalseekbar on the net, briefly describe his use:
When the size of the slider is larger than the background below, set the
android:minheight= "19dip"
android:maxheight= "19dip"
19dip is the width of the seek_img picture.
While the Layout_width value of the control is the width and height value of the throne slider
[XHTML]View PlainCopy
- <Com.android.VerticalSeek
- android:id="@+id/focus_seekbar"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:progressdrawable="@drawable/seekbar_img"
- android:thumb="@drawable/thumb"
- android:thumboffset="0dip"
- Android:max = " the"
- android:layout_centervertical="true"
- android:minheight="19dip"
- android:maxheight="19dip"
- android:paddingleft=" -15dip"
- android:paddingright=" -15dip"/>
Such a small problem, it took me half a day to get out. There are too few resources on the Internet to share with you.
<?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>
<corners android:radius= "5dip"/>
<gradient
Android:startcolor= "#ff364956"
Android:centercolor= "#ff444444"
android:centery= "0.75"
Android:endcolor= "#ff00112e"
Android:angle= "90"
/>
</shape>
</item>
<item android:id= "@android: Id/secondaryprogress" >
<clip>
<shape>
<corners android:radius= "5dip"/>
<gradient
Android:startcolor= "#80364956"
Android:centercolor= "#802f67a6"
android:centery= "0.75"
Android:endcolor= "#8000112e"
Android:angle= "270"
/>
</shape>
</clip>
</item>
<item android:id= "@android: Id/progress" >
<clip>
<shape>
<corners android:radius= "5dip"/>
<gradient
Android:startcolor= "#ff9ee5ff"
Android:centercolor= "#ff9ee5ff"
android:centery= "0.75"
Android:endcolor= "#ff9ee5ff"
Android:angle= "90"
/>
</shape>
</clip>
</item>
</layer-list>
In custom Seekbar, the thumb is overwritten with part of the problem