How to change the color of the Progress Bar in Android?- (I tried one way,and it isn't working) [duplicate] How to change the color of the Progress Bar in Android?- (I tried one way,and it isn't working) [duplicate] xml xml

How to change the color of the Progress Bar in Android?- (I tried one way,and it isn't working) [duplicate]


If you just want to change the colour, add a colour filter to your progress bar:

pbHeaderProgress.getIndeterminateDrawable().setColorFilter(Color.RED, Mode.MULTIPLY);

The Mode parameter, refers to the PorterDuff.Mode Values - available here.


I just found a way. I don't even need a separate xml file to change the color as the progress bar is of type "indeterminate:true"

I used the following to change the color of my progress bar:

pbHeaderProgress.getIndeterminateDrawable().setColorFilter(Color.parseColor("#C0D000"), android.graphics.PorterDuff.Mode.SRC_ATOP);

You can get variety of hex color codes from here: http://www.nthelp.com/colorcodes.htmor http://www.color-hex.com/