Search code examples
androidandroid-progressbar

Practical usage of ContentLoadingProgressBar


I was going through developer site of android and I found a class named ContentLoadingProgressBar. By seeing this class I come up with some questions in my mind. It would be great if someone answers my questions.

  1. What is the difference between Normal ProgressBar and ContentLoadingProgressbar?
  2. What is the practical usage of ContentLoadingProgressBar?
  3. Can we show/hide this progressbar according to our requirement?

  4. How can I custom style this progressBar?

Thanks for your help in Advance. It would be great if someone explain it using codes and examples. Thank you.


Solution

  • 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