2016-02-07 11 views
1

我遵循示例here尝试创建“繁忙”旋转进度轮。Android'busy spinner'(进度条)未着色

微调的外观在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中看到的那样,我已经将微调器定义为一个漂亮的蓝色渐变,但颜色不起作用。

+0

这是在一个棒棒糖HTC One和在最新的Nexus 5 Rom的模拟器。 –

回答

1

您正在为ProgressBar设置不确定的属性,并且具有不确定的进度。

要设置可绘制的不确定进度,请使用indeterminateDrawable属性。你正在做的是设置drawable进行确定的进度,这通常是一个从0到100%水平进度的条。