0

I have a Fragment ,in that Four Progress bars,in that two progress bars have a Maximum limit

I have one Custom Progress in that one Text view in that text view time is Updated for every minute and Total Hours for that progress bars 11 hrs

for example

the time is updated for one minute,in the bottom text view for the progress bar is 11hrs 59 min left like that its is showing

That is working fine for me,so here My doubt is

this 11hrs 59 min left must be 0hrs 0 mins automatically My progress bar color will change into red color and start from red color

how we can do this?

2 Answers2

1

You can adjust the color of the ProgressBar programatically (you can do this whenever you need based on the time, or other code).

Get a reference to the ProgressBar, then use the APIs to set the color, here is an example of setting the color of the Indeterminate progress bar to blue:

ProgressBar mainProgress = (ProgressBar) findViewById(R.id.progress_main);
mainProgress.getIndeterminateDrawable().setColorFilter(this.getResources().getColor(R.color.light_blue_500), android.graphics.PorterDuff.Mode.MULTIPLY);
Booger
  • 18,579
  • 7
  • 55
  • 72
0

As @Ish said, progressDrawable is what you are looking for. You just make a simple drawable asset in the color you want to replace the standard progressBar with and set it accordingly

erp
  • 2,950
  • 9
  • 45
  • 90