我的布局xml如下:
<SeekBar
android:id="@+id/progress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_margin="10dp"
android:gravity="center"
android:progressDrawable="@drawable/progressbar_drawable"
android:progress="50"
android:thumb="@drawable/progressbar_handle_selector"
android:layout_toLeftOf="@+id/showChat"
android:layout_toRightOf="@+id/play" />
进度条的进度图像如下:
@drawable/progressbar_drawable
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@android:id/background" android:drawable="@drawable/bg_progressbar_9patch"/>
<item android:id="@android:id/progress">
<clip>
<shape>
<gradient
android:angle="90"
android:endColor="#d9b546"
android:startColor="#cc520f" />
</shape>
</clip>
</item>
</layer-list>
因此,背景位图(白色)在高度上不会拉伸,并且相对于进度可绘制对象(橙色)仍然过低,以下是一个示例:
![enter image description here](https://istack.dev59.com/jcu23.webp)
![enter image description here](https://istack.dev59.com/Cweoh.webp)
更新:
PNG 资源:
![enter image description here](https://istack.dev59.com/wAPZp.webp)
![enter image description here](https://istack.dev59.com/q8TzB.webp)