Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lollipop Progress Bar Tinting

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?

<ProgressBar     style="?android:attr/progressBarStyleLarge"     android:layout_width="50dp"     android:layout_height="50dp"     android:backgroundTintMode="src_in"     android:indeterminate="true"     android:indeterminateTint="#f00" /> 

Many thanks.

like image 580
Jumpa Avatar asked Jun 24 '15 08:06

Jumpa


People also ask

How do you change how much of the progress bar is filled in?

You need to call setLevel on the ClipDrawable. It takes a value from 0 to 10000. So, progress. setLevel(2500) would be 25% full.


1 Answers

Try changing your ProgressBar to this

<ProgressBar android:id="@+id/view_progress" style="?android:attr/progressBarStyleLarge" android:layout_width="50dp" android:layout_height="50dp" android:indeterminate="true" android:indeterminateTintMode="src_in" android:indeterminateTint="@color/red" /> 

Also you can do it programmaticaly doing this :

ProgressBar progressBar; progressBar = (ProgressBar)findViewById(R.id.view_progress); progressBar.getProgressDrawable().setColorFilter(Color.RED, Mode.SRC_IN); 

References

Setting in ProgressBar Tint color

like image 105
Skizo-ozᴉʞS Avatar answered Oct 10 '22 12:10

Skizo-ozᴉʞS