Android ProgressBar Tinting ProgressBar

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Using an AppCompat theme, the ProgressBar's color will be the colorAccent you have defined.

5.0

To change the ProgressBar color without changing the accent color you can use theandroid:theme attribute overriding the accent color:

<ProgressBar  
    android:theme="@style/MyProgress"
    style="@style/Widget.AppCompat.ProgressBar" />

<!-- res/values/styles.xml -->
<style name="MyProgress" parent="Theme.AppCompat.Light">  
    <item name="colorAccent">@color/myColor</item>
</style>  

To tint the ProgressBar you can use in the xml file the attributes android:indeterminateTintMode and android:indeterminateTint

<ProgressBar
    android:indeterminateTintMode="src_in"
    android:indeterminateTint="@color/my_color"
/>


Got any Android Question?