我以这里为例,尝试创建一个“繁忙”的旋转进度轮。
旋转器的外观在busy_spinner.xml中定义如下:
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="90"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="360">
<shape
android:innerRadiusRatio="3"
android:shape="ring"
android:tint="#0000FF"
android:thicknessRatio="7.0">
<gradient
android:angle="0"
android:centerColor="#0000FF"
android:endColor="#9999FF"
android:type="sweep"
android:useLevel="false" />
</shape>
</rotate>
它包含在我的布局文件中如下:
<ProgressBar
android:id="@+id/working_bluebadgeparking_reachable"
style="?android:attr/progressBarStyleLarge"
android:layout_width="24dp"
android:layout_height="24dp"
android:visibility="gone"
android:progressDrawable="@drawable/busy_spinner" />
通过编程打开和关闭可见性,一切看起来都很好,除了旋转器是红色的!
正如您在busy_spinner.xml中所看到的,我已经将旋转器定义为一个很好的蓝色梯度,但是颜色不起作用。
发布于 2016-02-09 00:05:28
您为进度不确定的ProgressBar设置了错误的属性。
若要设置不确定进度的可绘制性,请使用indeterminateDrawable属性。您要做的是设置确定进度的可绘制性,这通常是水平从0到100%的条形图。
https://stackoverflow.com/questions/35258252
复制相似问题