我认为您在这里不需要 9 补丁。只需动态更改填充条的宽度(我猜那是鲜红色的),然后设置正确的scaleType
.-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/bar_dark" />
<ImageView
android:layout_width="200dp"
android:layout_height="wrap_content"
android:scaleType="matrix"
android:src="@drawable/bar_light" />
</RelativeLayout>

对于一个ProgressBar
组件,这篇文章可能会有所帮助。-
Android ProgressBar UI 自定义布局