2016-02-07 19 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%水平進度的條。