I would like to know how I can change indeterminate ProgressBar color from basis white/grey color to black ? When I change the indeterminateDrawable, I get a static image instead of a moving animated progressBar. Is there any way to do it simply in XML? 
 
    
    - 8,084
- 8
- 48
- 62
 
    
    - 819
- 1
- 7
- 3
9 Answers
progressBar.getIndeterminateDrawable().setColorFilter(
            getResources().getColor(Your_Color),
            android.graphics.PorterDuff.Mode.SRC_IN);
and replace Your_Color with the desired color like: R.color.your_color_code
 
    
    - 1,224
- 9
- 6
- 
                    This is the most quick and easy way. – Pau Arlandis Martinez Dec 16 '15 at 14:00
- 
                    16Could define in xml: `android:indeterminateTint="@colors/your_color"` `android:indeterminateTintMode="src_in"` – Peter Zhao Jan 05 '16 at 10:45
- 
                    2@zhaoyuanjie android:indeterminateTint only works on API level 21+ – Vinay W Jan 14 '17 at 10:10
- 
                    I'm glad I scrolled down - this should be the accepted answer. – Zsolt Safrany Feb 09 '17 at 01:04
- 
                    is all that porter duff business really necessary? :( – Nerdy Bunz Aug 06 '18 at 11:19
- 
                    unfortunately this does not work for some devices, for example on the HUAWEI Mate9 this does not work :( I would advise to use a layer drawable :( – scholt Apr 18 '19 at 14:42
To get a ProgressBar in the default theme that is to be used on white/light back ground, use one of the inverse styles:
<ProgressBar style="@android:style/Widget.ProgressBar.Inverse"/>
<ProgressBar style="@android:style/Widget.ProgressBar.Large.Inverse"/>
<ProgressBar style="@android:style/Widget.ProgressBar.Small.Inverse"/>
This will usually give you a black on transparent ProgressBar, but some OS installs use custom assets. If you're looking for a specific color, you'll have to roll your own drawables by following the instructions provided by CommonsWare.
 
    
    - 3,291
- 2
- 29
- 40
- 
                    This doesn't appear to be a device-agnostic solution. On my LG Optimus 2X Speed, an indeterminate ProgressBar is still always black, while on a HTC Desire HD with CyanogenMod for 2.3.3, it is always red. – Paul Lammertsma Apr 06 '11 at 15:47
- 
                    @Paul - Yes, you are correct. Many device manufactures customize the themes, and the default theme can change between Android versions. I'll correct the text above – Anm Apr 20 '11 at 15:26
I see other answers are quite old, in order to change the indeterminate ProgressBar color you have just to set android:indeterminateTint and android:indeterminateTintMode attributes in your ProgressBar item directly in XML:
<ProgressBar
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:indeterminateTint="@color/colorPrimary"
    android:indeterminateTintMode="src_in"
    android:indeterminate="true" />
android:indeterminateTint - Tint to apply to the indeterminate progress indicator.
Must be a color value, in the form of
"#rgb","#argb","#rrggbb","#aarrggbb", or a reference to a resource@color/colorPrimary.
android:indeterminateTintMode - Blending mode used to apply the progress indicator tint.
Must be one of the following constant values:
add,multiply,screen,src_atop,src_inorsrc_over
Getter and Setter methods for these attributes are:
- getIndeterminateTintList()
- getIndeterminateTintMode()
- setIndeterminateTintList(ColorStateList tint)
- setIndeterminateTintMode(PorterDuff.Mode tintMode)
All of them were added in API level 21
 
    
    - 3,414
- 20
- 33
- 47
- 
                    1So frustrating! In android studio you have to use the View All Attributes option to access indeterminateTintMode and then change it to src_in...I was NOT going to figure this out on my own. Thanks! – Scooter Jul 01 '18 at 15:22
I make sample project and post in in my blog. Please, look at. http://www.hrupin.com/2011/09/21/how-to-make-custom-indeterminate-progressbar-in-android-or-how-to-change-progressbar-style-or-color
Hope, it help you
 
    
    - 6,932
- 2
- 31
- 47
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@android:id/background" android:drawable="@drawable/bg" />
    <item android:id="@android:id/secondaryProgress" android:drawable="@drawable/secondary" />
    <item android:id="@android:id/progress" android:drawable="@drawable/progress" />
</layer-list>
 
    
    - 74,861
- 18
- 132
- 169
 
    
    - 78
- 1
- 6
For API less than 23 use
progressBar.getIndeterminateDrawable().setColorFilter(
       getResources().getColor(Your_Color),
        android.graphics.PorterDuff.Mode.SRC_IN);
else use
progressBar.getIndeterminateDrawable().setColorFilter(
        ContextCompat.getColor(context, Your_Color),
        android.graphics.PorterDuff.Mode.SRC_IN);
 
    
    - 43
- 3
Override android:colorControlActivated in your AppTheme which should be in your styles.xml:
<style name="AppTheme" parent="...">
    ...
    <item name="android:colorControlActivated">@color/beautiful_color</item>
    ...
</style>
Works on API 21+
With the Material Component Library you can use the CircularProgressIndicator with these attributes:
- indicatorColor
- trackColor
Something like:
<com.google.android.material.progressindicator.CircularProgressIndicator
       android:indeterminate="true"
       app:trackColor="@color/red600Light"
       app:indicatorColor="@color/red600Dark"
       app:indicatorSize="50dp"
       .../>
You can also use a Multi-color indeterminate indicator.
<com.google.android.material.progressindicator.CircularProgressIndicator
            android:indeterminate="true"
            app:trackColor="@color/red600Light"
            app:indicatorColor="@array/progress_colors"
            app:indeterminateAnimationType="contiguous"/>
with array/progress_colors:
  <integer-array name="progress_colors">
    <item>@color/...</item>
    <item>@color/...</item>
    <item>@color/...</item>
  </integer-array>
 
    
    - 320,139
- 94
- 887
- 841
actually all u need to do (for both cirle and bar) is create an xml file in drawable as shown below...... progress_spinner_001 points to whatever image u want to animate and duration ... how long u want to display each frame for....... and set ur android:indeterminateDrawable= filename_in_drawable....
<?xml version="1.0" encoding="utf-8"?>
<animation-list
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false">
<item android:drawable="@drawable/progress_spinner_001" android:duration="300" />
<item android:drawable="@drawable/progress_spinner_002" android:duration="300" />
<item android:drawable="@drawable/progress_spinner_003" android:duration="300" />
  <item android:drawable="@drawable/progress_spinner_004" android:duration="300" />
    <item android:drawable="@drawable/progress_spinner_005" android:duration="300" />
      <item android:drawable="@drawable/progress_spinner_006" android:duration="300" />
     <item android:drawable="@drawable/progress_spinner_007" android:duration="300" />
    <item android:drawable="@drawable/progress_spinner_008" android:duration="300" />
</animation-list>
ps u may need to resize the progressbar to show as desired
 
    
    - 74,861
- 18
- 132
- 169
 
    
    - 15
- 
                    4-1: this answer says "as shown below" but it shows nothing. I find it very hard to understand. – Richard Le Mesurier Feb 16 '12 at 14:53
