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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With