6

I am trying to place a circular progress bar, start it initially in indeterminate mode and as soon as the download starts and progress is available convert it to determinate mode and set its progress. Code works absolutely fine when using style progressBarStyleHorizontal and as soon as I change it to progressBarStyleInverse setting the progress has no effect. Progress bar starts indeterminate and continues for ever the same.

What surprised me is on setting android:indeterminate=false in xml also has no effect.

Here is the declaration of progress bar in xml

<ProgressBar
                    style="?android:attr/progressBarStyleHorizontal"
                    android:indeterminate="false"
                    android:layout_gravity = "center"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"/>

This is how am updating my progress bar progress. Obviously I have an id to it I have removed it in xml pasted. I have the reference of progress bar which I got using findViewById.(Reference to progress bar is not an issue, if you are thinking thats the issue)

holder.progressbar.setIndeterminate(false);
holder.progressbar.invalidate();
holder.progressbar.setProgress(/*value */);

What mistake am I making?? Please help. I wasted almost 5 hours on this issue. Please help.

Thanks in advance.

Sandeep Bhandari
  • 19,999
  • 5
  • 45
  • 78

1 Answers1

17

The trick is that you need to use style="?android:attr/progressBarStyleHorizontal" even though it's a circular ProgressBar. And set a circular drawable as a progress drawable.

Refer to this question :

Android Circular Determinate ProgressBar

xarlymg89
  • 2,552
  • 2
  • 27
  • 41
zCode93
  • 186
  • 1
  • 5
  • any idea what progress_circular_background and progress_particle drawable he is talking about?? – Sandeep Bhandari Feb 21 '16 at 19:37
  • hey I figured out the solution :) link you specified gave idea of the solution but I could not figure out the image though. Actually those images are not required. I achieved what I wanted with the help of your link and little more googling Thanks buddy. – Sandeep Bhandari Feb 23 '16 at 08:20