I\'m using an horizontal progress bar in my Android application, and I want to change its progress color (which is Yellow by default). How can I do it using code
Hit the same problem while working on modifying the look/feel of the default progress bar. Here is some more info that will hopefully help people :)
a-z0-9_.
(ie. no capitals!)R.drawable.filename
myProgressBar.setProgressDrawable(...)
, however you need can't just refer to your custom layout as R.drawable.filename
, you need to retrieve it as a Drawable
:Resources res = getResources();
myProgressBar.setProgressDrawable(res.getDrawable(R.drawable.filename);