14

I have a circular ProgressBar to count down time. It workes perfectly on kitkat and before, but on android L it always shows a full circle no matter what progress I set.

Image

layout.xml

<ProgressBar
                android:id="@+id/progressBar1"
                style="?android:attr/progressBarStyleHorizontal"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:indeterminate="false"
                android:max="200"
                android:progress="100"
                android:progressDrawable="@drawable/progresscircle" />

progresscircle.xml

 <?xml version="1.0" encoding="utf-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

    <item>
        <shape
            android:innerRadiusRatio="3.4"
            android:shape="ring"
            android:thicknessRatio="6.0" >
            <solid 
                android:color="#ffffff" />
        </shape>
    </item>
        <item>
            <rotate
                android:drawable="@drawable/progress_particle"
                android:fromDegrees="0"
                android:pivotX="50%"
                android:pivotY="50%"
                android:toDegrees="360" />
        </item>

    </layer-list>
Jonathan S
  • 491
  • 1
  • 5
  • 11
  • Your start and end colors are identical when expanded to ARGB. Have you tried android:startColor="#00ffffff"? – alanv Oct 23 '14 at 21:04
  • You're right, this used to be two different colors. Now it should be just white (see updated question). Problem is still the same. – Jonathan S Oct 24 '14 at 08:50
  • What is the expected behavior? Can you include a screenshot? From the code, it looks like a solid ring that rotates around its center -- which would look the same at every point in the animation. – alanv Oct 24 '14 at 17:32
  • I linked a screenshot above, because i can't include it directly with reputation below 10. Here's the link: http://youspeakschwaebisch.de/progressbar.jpg – Jonathan S Oct 24 '14 at 17:47

1 Answers1

29

The default value for android:useLevel under the tag incorrectly changed to false in the L Preview build. You can work around this by explicitly setting it to true.

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item>
        <shape
            ...
            android:useLevel="true">
            <solid
                ...
alanv
  • 23,966
  • 4
  • 93
  • 80