I'm using an horizontal progress bar in my Android application, and I want to change its progress color (which is Yellow by default). How can I do it using code
(not XML)?
Android – How to change progress bar’s progress color in Android
androidandroid-progressbarmaterial-designprogress-indicator
Related Topic
- Android – Is quitting an application frowned upon
- Java – Download a file with Android, and showing the progress in a ProgressDialog
- Android “Only the original thread that created a view hierarchy can touch its views.”
- Android – How to change ProgressBar’s progress indicator color in Android
- Android – How to change spinner text size and text color
- Java – Proper use cases for Android UserManager.isUserAGoat()
- R – Finding perfect numbers between 1 and 100
Best Answer
For a horizontal ProgressBar, you can use a
ColorFilter
, too, like this:Note: This modifies the appearance of all progress bars in your app. To only modify one specific progress bar, do this:
If progressBar is indeterminate then use
getIndeterminateDrawable()
instead ofgetProgressDrawable()
.Since Lollipop (API 21) you can set a progress tint: