Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lollipop - Indeterminate ProgressBar color change - Programmatically

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); 
like image 676
Vamsi Challa Avatar asked Nov 21 '14 12:11

Vamsi Challa


1 Answers

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

like image 77
Pedro Oliveira Avatar answered Oct 07 '22 17:10

Pedro Oliveira