When using the progress drawable provided by the Android platform it
should not be possible to change the color dynamically as you cannot
access the GradientDrawable. The resource ID for the GradientDrawable
used as progress indication is defined in com.android.internal.R and
you do not have access to it from your application. Changing colors
dynamically should be possible if you use your own drawable as
progress drawable.

The platform's (horizontal) progress drawable is a clipped
GradientDrawable inside a LayerDrawable (see
http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob_plain;f=core/res/res/drawable/progress_horizontal.xml;hb=HEAD).
You can use it in your application and replace the progress drawable
with it. However, to get access to the GradientDrawable from Java you
should package the GradientDrawable inside a ScaleDrawable (instead of
packaging it inside of a ClipDrawable). Then you can get access to it
via ScaleDrawable.getDrawable().

Kind regards

Droidsan

On Jun 17, 7:39 am, haric zhu <[email protected]> wrote:
> Have you made an xml like default theme does?
>
> 2010/6/17 ls02 <[email protected]>
>
> > Apparently ProgressBar.setProgressDrawable has bug, if called to set
> > new drawable, progress bar disappears completely. Is there any other
> > way to change progress bar color dynamically at run time?
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<android-developers%[email protected]>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Best Regards
>
> Haric

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en

Reply via email to