When user cancel a download running, progress bar must go to first. for this purpose I set progress (0) but progress bar don't go to first but remains in that same situation:
progressBar.setProgress(0);
What should I do?
Progress bar has two modes:
1.Indeterminate mode
<ProgressBar
android:id="@+id/indeterminateBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
2.Determinate mode
<ProgressBar
android:id="@+id/determinateBar"
style="@android:style/Widget.ProgressBar.Horizontal" //this line is import!
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:progress="25"/> //initial progress bar position(25%), also could be set via java codes.
Notice: setProgress
method is invalid for indeterminate mode.
I understood that it works properly. In fact, after running this method, I should stop the loop that contains update the progress bar
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.