10

I am using the code below to change the color of Indeterminate ProgressBar. This works well, till KitKat. But on Lollipop, it just stays Green. Can anyone help me out with this. I want to do it through Java and not XML.

Code: This sets the spinner color to pink

pd.getIndeterminateDrawable().setColorFilter(0xFFeA6060,
                    android.graphics.PorterDuff.Mode.MULTIPLY); 
Cœur
  • 37,241
  • 25
  • 195
  • 267
Vamsi Challa
  • 11,038
  • 31
  • 99
  • 149

1 Answers1

23

You're using multiply which means that you will change to a color depending on the current color (which is green):

enter image description here

Try using android.graphics.PorterDuff.Mode.SRC_ATOP for example.

If want to use the real color that you provided then use PorterDuff.Mode.SRC_IN

Pedro Oliveira
  • 20,442
  • 8
  • 55
  • 82