I\'m on a Lollipop device (MotoG 2014), I read about progress bar tinting, but this is not working...I get the default progress bar color. What am I missing here?
To avoid tinting the ProgressBar
background as well, you should get a reference to the exact bitmap from the inner ProgressBar
LayerDrawable
. This is a hacky way of doing it, but it works.
LayerDrawable layerDrawable = (LayerDrawable) progressBar.getProgressDrawable();
Drawable drawable = layerDrawable.getDrawable(2); // The progress bitmap
drawable.setColorFilter(color, PorterDuff.Mode.SRC_IN);