You need to dynamically change the color of the horizontal ProgressBar, depending on the value of progress. Did so:

progressbar.getProgressDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN); 

The color changes.

I don’t like that the ProgressBar is too narrow, the android: layout_height and android: minHeight attributes do not help. Made your own drawable for ProgressBar

 <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@android:id/background" android:gravity="center_vertical|fill_horizontal"> <shape android:shape="rectangle" android:tint="?attr/colorControlNormal"> <size android:height="20dp" /> <solid android:color="@android:color/white" /> </shape> </item> <item android:id="@android:id/secondaryProgress" android:gravity="center_vertical|fill_horizontal"> <scale android:scaleWidth="100%"> <shape android:shape="rectangle" android:tint="?attr/colorControlActivated"> <size android:height="20dp" /> <solid android:color="@android:color/white" /> </shape> </scale> </item> <item android:id="@android:id/progress" android:gravity="center_vertical|fill_horizontal"> <scale android:scaleWidth="100%"> <shape android:shape="rectangle" android:tint="?attr/colorControlActivated"> <size android:height="20dp" /> <solid android:color="@android:color/white" /> </shape> </scale> </item> 

Appearance is now comfortable, but when changing colors (as described above), the entire ProgressBar is filled with color.

Question. How to make a standard ProgressBar thicker or color custom?

  • The link advise the same thing as your drawable. When progressbar.getProgressDrawable (). SetColorFilter (color, PorterDuff.Mode.SRC_IN), the entire progress bar is filled with color. - dzukp

0