【发布时间】:2014-04-18 08:38:28
【问题描述】:
我正在尝试使进度条变圆,背景工作正常,但进度条(橙色)没有变圆,有什么解决方案吗?
这是我的应用程序的图像:
这就是我想要的:
这是我的进度条的代码:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@android:id/background">
<shape>
<corners android:radius="13dip" />
<gradient
android:angle="270"
android:centerColor="#ff747674"
android:centerY="0.5"
android:endColor="#ff9d9e9d"
android:startColor="#ff9d9e9d" />
</shape>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<corners
android:radius="13dip" />
<gradient
android:startColor="#f3c30b"
android:centerColor="#efa200"
android:centerY="0.5"
android:endColor="#ce7428"
android:angle="270"
/>
</shape>
</clip>
</item>
【问题讨论】:
-
使用 ClipDrawable 会切割你的圆形 Drawable,这就是为什么你看不到圆形右侧,使用自定义 Drawable reacring 来改变关卡
-
你能给我举个例子吗?
-
class D extends Drawable { ... 并在内部覆盖 onLevelChange 调用 invalidateSelf,因此任何对 setLevel 的调用都会使 Drawable 无效
标签: android progress-bar progress rounded-corners