Practical usage of ContentLoadingProgressBar
Here are my answers!
What is the difference between Normal ProgressBar and ContentLoadingProgressbar?
ContentLoadingProgressbar
waits a minimum time to be dismissed before showing using hide()
like with-in 0.5 seconds.So even the show()
gets called this can be dismissed before it appear on the screen.
What is the practical usage of ContentLoadingProgressBar
It prevents very fast flickering stuff that you might see with "naive" implementations.
Can we show/hide this progressbar according to our requirement
Yes
How can I custom style this progressBar
<android.support.v4.widget.ContentLoadingProgressBar
android:id="@+id/address_looking_up"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:visibility="visible" />
replace style with android:theme
https://stackoverflow.com/a/38282149/5188159
Let's say you want to show a ProgressBar for some background operation that may take less than 500ms or more than 5 seconds.
You call
progressBar.show()
Then you start your background operation.If your background operation is over within 500ms. Then you call
progressBar.hide()
Now the user will see a flicker of the progress bar appearing and disappearing within a fraction of a second.
Introducing ContentLoadingProgressBar:
When you use this progressbar, then it will wait for a minimum time before showing the progress dialog. Which means if the time between show()
call and hide()
call is less than that minimum time, then there wont be any dialog to be shown to the user.