I have a progressBar using the ProgressBar class.
Just doing this:
progressBar = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizont
setColorFilter with 2 arguments is deprecated and the other answer pointing to use LightingColorFilter neither worked for me so
val progressBar = ProgressBar(context, null, android.R.attr.progressBarStyle).apply {
val colorFilter = PorterDuffColorFilter(
ContextCompat.getColor(context, R.color.yourColor),
PorterDuff.Mode.MULTIPLY
)
indeterminateDrawable.colorFilter = colorFilter
}
That will programmatically give you the circular progress bar with your color