2

How do I create a progress bar with blue progress indication, grey background and a transparent gap (black in the example) between the sections: progress bar with a gap between sections

I've tried to play around with shapes, to create the left section with border only on the right. The closest example that I could find was shape with bottom stroke, but I was unable to modify it to display the gap required in my case.

Unless I get shape to work, I might end up using setSecondaryProgress() in code.

Community
  • 1
  • 1
Juuso Ohtonen
  • 8,826
  • 9
  • 65
  • 98
  • http://www.learn-android-easily.com/2013/05/custom-progress-bar-in-android.html – Rohit Jun 03 '14 at 05:10
  • use setProgressDrawable, you will need to create your custom Drawable in the code as what you want cannot be done in xml, you will need to override onLevelChange and call invalidateSelf – pskink Jun 03 '14 at 05:45
  • if you are unsure how it works see ClipDrawable sources,, ClipDrawable is a part of std progress Drawable – pskink Jun 03 '14 at 07:28
  • @pskink, I followed your answer http://stackoverflow.com/a/21060826/1097104. With some adaptations I can fit it for my needs. If you could add an answer to this question also, I could accept it. – Juuso Ohtonen Jun 03 '14 at 08:01

1 Answers1

1

use setProgressDrawable, you will need to create your custom Drawable in the code as what you want cannot be done in xml, you will need to override onLevelChange and call invalidateSelf, see Custom ProgressBar for a sample implementation

Community
  • 1
  • 1
pskink
  • 23,874
  • 6
  • 66
  • 77