作为我的图片,搜索栏进度 = 0,但搜索栏拇指中心不在起点。我的代码:
<SeekBar android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progressDrawable="@drawable/seekbar_progress"
android:thumb="@drawable/seekbarthumb"
android:minHeight="10dip"
android:maxHeight="10dip"
android:thumbOffset="0px"
android:max="100"
android:id="@+id/bright_seekbar"
android:layout_marginLeft="60dip"/>
seekbar_progress
<?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="#ff9d9e9d"
android:centerColor="#ff5a5d5a"
android:centerY="0.75"
android:endColor="#ff747674"
android:angle="270"
/>
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners android:radius="5dip" />
<gradient
android:startColor="#80ffd300"
android:centerColor="#80ffb600"
android:centerY="0.75"
android:endColor="#a0ffcb00"
android:angle="270"
/>
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="5dip" />
<gradient
android:startColor="#FFD700"
android:centerColor="#FFB90F"
android:centerY="0.75"
android:endColor="#FFA500"
android:angle="270"
/>
</shape>
</clip>
</item>
</layer-list>
seekbarthumb.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/pressed_button__volume" />
<item android:state_focused="true"
android:drawable="@drawable/pressed_button__volume" />
<item
android:drawable="@drawable/default_button__volume" />
</selector>
default_button__volume 是图像