2

I want to have a progress bar which goes as a countdown from 10 to 0 and I want from 10 to 7 to be green then from 7 to 3 yellow and from 3 to 0 red. Can that be accomplished only in XML? I took a look at Android change Horizonal Progress bar color but that just changes the color of the bar, doesn't give me three color bar. Second question is how can I make the progress bar goes from max to 0 instead 0 to max? I mean, I want it to start full and then getting empty.

Thanks in advance. Guillermo.

Community
  • 1
  • 1
polonskyg
  • 4,269
  • 9
  • 41
  • 93

1 Answers1

2

To have different colors for the progress bar, you have to play around with background drawable for the progress bar (please take a look at this example http://bazaar.launchpad.net/~financisto-dev/financisto/trunk/view/head:/res/drawable/progress_horizontal_budget.xml)

To go from max to 0 just use setProgress and set it to max first, then decrement..

denis.solonenko
  • 11,645
  • 2
  • 28
  • 23