Practical use of ContentLoadingProgressBar

I went through the android developer site and I found a class called ContentLoadingProgressBar . Seeing this class, I came up with some questions in my mind. It would be great if someone answered my questions.

  • What is the difference between Normal ProgressBar and ContentLoadingProgressbar ?
  • What is the practical use of the ContentLoadingProgressBar?
  • Can we show / hide this progress indicator in accordance with our requirement?

  • How can I customize this progress bar?

Thanks for your help at Advance. It would be great if someone explained this using codes and examples. Thanks.

+6
source share
3 answers

Here are my answers!

What is the difference between Normal ProgressBar and ContentLoadingProgressbar?

ContentLoadingProgressbar waits for the minimum time that needs to be removed until the use of hide() is shown, for example, from 0.5 sec. So even the called show() call can be fired before it appears on the screen.

What is the practical use of the ContentLoadingProgressBar

This prevents very fast flickering material, which you can see with naive implementations.

Can we show / hide this progress indicator in accordance with our requirement

Yes

How can I customize this progress bar

 <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 fooobar.com/questions/25865 / ...

+9
source

Suppose you want to show a ProgressBar for some background operation, which may take 500 ms or more than 5 seconds.

  • You call progressBar.show (). You start the background mode.
  • If your background operation completed within 500 ms. Then you call progressBar.hide ()

    Now the user will see the flicker of the progress bar appearing and disappearing in a split second.

Introducing the ContentLoadingProgressBar :

When you use this progress indicator, it will wait for the minimum time before displaying the progress dialog. This means that if the time between the call to show () call and hide () is less than this minimum time, then no dialog will be displayed to the user.

+3
source

According to docs :

ContentLoadingProgressBar implements a ProgressBar that waits for the minimum time that must be fired before showing. After visibility, a progress bar will be displayed for a minimum period of time in order to avoid "flashes" in the user interface, when the event can take a significantly variable time (from none to the level of the perceived user).

This clearly indicates that it is no different from a regular ProgressBar . Also, this is a refinement of the UI to be exact. those. ContentLoadingProgressBar will not be displayed if hide() is called less than 0.5s after show() executed, thereby preventing quick flickering in the UI . Hope it helps.

+2
source

Source: https://habr.com/ru/post/1014044/


All Articles