Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use indeterminate progress bar in appcompat-v7 r21 library?

Using the new r21 appcompat library, I wanted to show an indeterminate (spinning) progress bar in the Toolbar.

Previously, using the < r21 appcompat library, it worked, but it seems that there is no implementation of the progress bar in r21. Am I right? Is there a way for this without creating a custom progress bar?

My onCreate method starts with:

    supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    super.onCreate(savedInstanceState);
    setSupportProgressBarIndeterminate(true);
    setSupportProgressBarIndeterminateVisibility(true);
like image 326
Randy Sugianto 'Yuku' Avatar asked Jan 15 '15 19:01

Randy Sugianto 'Yuku'


People also ask

What is indeterminate progress bar android?

Indeterminate mode is the default for progress bar and shows a cyclic animation without a specific amount of progress indicated. The following example shows an indeterminate progress bar: <ProgressBar android:id="@+id/indeterminateBar" android:layout_width="wrap_content" android:layout_height="wrap_content" />

What are the different types of progress bars?

There are 2 types of progress bars: determinate and indeterminate. The former is used when the amount of information that needs to be loaded is detectable. The latter is used when the system is unsure how much needs to be loaded or how long it will take.

How do I change the progress bar icon on Android?

Go to the activity_main. xml file and refer to the following code. Open the activity_main. xml file and in the ProgressBar tag and set the drawable in indeterminateDrawable attribute.


1 Answers

In short: no, you have to create a custom progress bar in your Toolbar. Progress is not supported in action bars for 21+

like image 188
Diolor Avatar answered Oct 18 '22 10:10

Diolor