回答

0

我不认为你需要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> 

enter image description here


对于ProgressBar组件,这个帖子可以help.-

Android ProgressBar UI custom layout

+0

不是那么简单。图像包含纹理,如果我改变宽度条纹变形。酒吧应该是可扩展的。 – ephramd

+0

我的不好,忘了'scaleType',检查我的编辑。 – ssantos

+0

但scaleType是imageview的属性,我无法使用进度条实现此解决方案。 – ephramd

0

无需9补丁。您可以使用自定义XML drawable。下面是一个很好的教程:Android Tutorials for Beginners

Google“android custom progress bar”for more examples。