如何创建这种类型的纹理进度条“line-diag”(ninepatch?)?
我已经阅读了一些线程,我认为解决方案是使用9-patch类型的图像。但我不明白该怎么做。你能解释我如何能够取得这个进步吧吗?
答案 0 :(得分: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>
对于ProgressBar
组件,这篇文章可以提供帮助.-
答案 1 :(得分:0)
不需要9补丁。您可以使用自定义XML drawable。这是一个很好的教程:Android Tutorials for Beginners
Google“ android自定义进度条”了解更多示例。