I want to be able to have a horizontal progress bar, where I can
change the color of the progress bar on the fly.

When I use setProgressDrawable() inside of onCreate(), it works fine.

When I use setProgressDrawable() anywhere else, the progress bar
disappears completely.

For reference, this is the content of the XML file I am setting the
drawable to:

<layer-list xmlns:android="http://schemas.android.com/apk/res/
android">
    <item android:id="@android:id/background">
        <shape>
            <corners android:radius="5dip" />
            <gradient
                    android:startColor="#ff9d9e9d"
                    android:centerColor="#ff5a5d5a"
                    android:centerY="0.75"
                    android:endColor="#ff747674"
                    android:angle="270"
            />
        </shape>
    </item>

    <item android:id="@android:id/secondaryProgress">
        <clip>
            <shape>
                <corners android:radius="5dip" />
                <gradient
                        android:startColor="#803e5dbf"
                        android:centerColor="#803e2ebf"
                        android:centerY="0.75"
                        android:endColor="#803e30bf"
                        android:angle="270"
                />
            </shape>
        </clip>
    </item>

    <item android:id="@android:id/progress">
        <clip>
            <shape>
                <corners android:radius="5dip" />
                <gradient
                        android:startColor="#ff3e5dbf"
                        android:centerColor="#ff3e2ebf"
                        android:centerY="0.75"
                        android:endColor="#ff3e30bf"
                        android:angle="270"
                />
            </shape>
        </clip>
    </item>
</layer-list>

Is there some limitations to calling setProgressDrawable()?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to