简体   繁体   中英

How to use ContentLoadingProgressBar and when should we use it instead of the default ProgressBar?

While searching for a way to display progress during loading content I found android.support.v4.widget.ContentLoadingProgressBar . Sadly I found nearly no Information about this view and did not get how to use it. And when should we use this view instead of the general Progress Bar ?

EDIT: I found this in the official Documentation :

ContentLoadingProgressBar implements a ProgressBar that waits a minimum time to be dismissed before showing. Once visible, the progress bar will be visible for a minimum amount of time to avoid "flashes" in the UI when an event could take a largely variable time to complete (from none, to a user perceivable amount)

I don't really understand what the advantages are against the normal progress bar ?

Also how should we implement it ? Should we call these show() and hide() methods or use it as normal Progress bars ?

Sometimes your asynchronous call (db, api, etc) may return quickly (let's say 200ms for example), but you don't want to show that ProgressBar for those 200ms because it would be a noticeable flash to the user. 200ms is not a very perceivable wait time, so you'll be ok not showing the progress bar at all. However, if the api call ends up being 2 seconds or more, you'll definite want to show a ProgressBar at that point. ContentLoadingProgressBar will take care of all of that for you.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM