Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When is indeterminate progressbar coming to Android Support Library

My applications UI is built using the Android Support Library, but there is currently no AppCompat version of the (intederminate) progressbar, which my app really needs.

I would prefer to not use any third party libraries to achieve material design progressbars, so I'm wondering if anyone sits on information about why it's not included in the support library, and if there is any sign of it arriving (and when).

like image 280
Joakim Avatar asked Nov 06 '15 08:11

Joakim


People also ask

What is indeterminate ProgressBar?

Android ProgressBar Indeterminate ProgressBar An indeterminate ProgressBar shows a cyclic animation without an indication of progress.

What is indeterminate android?

Indeterminate Progress Use indeterminate mode for the progress bar when you do not know how long an operation will take. Indeterminate mode is the default for progress bar and shows a cyclic animation without a specific amount of progress indicated.

What is a standard ProgressBar?

In Android, ProgressBar is used to display the status of work being done like analyzing status of work or downloading a file etc. In Android, by default a progress bar will be displayed as a spinning wheel but If we want it to be displayed as a horizontal bar then we need to use style attribute as horizontal.


1 Answers

Material Components Library

You can use the LinearProgressIndicator with the android:indeterminate="true" attribute:

<com.google.android.material.progressindicator.LinearProgressIndicator     android:indeterminate="true"     app:indicatorColor="?attr/colorPrimary"/> 

enter image description here

You can also use different colors using:

<com.google.android.material.progressindicator.LinearProgressIndicator         android:indeterminate="true"         app:indicatorColor="@array/progress_colors"         app:indeterminateAnimationType="contiguous"/> 

with:

  <integer-array name="progress_colors">     <item>@color/...</item>     <item>@color/....</item>     <item>@color/....</item>   </integer-array> 

enter image description here

You can also use the CircularProgressIndicator component to have a circular progress indicator:

<com.google.android.material.progressindicator.CircularProgressIndicator     android:indeterminate="true"     app:indicatorColor="?attr/colorPrimary"/> 

enter image description here

Note: It requires at least the version 1.3.0-alpha04


Jetpack compose

With 1.0.x you can use the LinearProgressIndicator or CircularProgressIndicator

// Indeterminate CircularProgressIndicator() LinearProgressIndicator()  // Determinate CircularProgressIndicator(progress = ..) LinearProgressIndicator(progress = ..) 

Example:

var progress by remember {  mutableStateOf(0.1f) }  LinearProgressIndicator(     backgroundColor = Color.White,     progress = progress,     color = Blue ) 

AppCompat

You can use a ProgressBar with an AppCompat style.

Just add this in your layout:

<ProgressBar         style="@style/Base.Widget.AppCompat.ProgressBar"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:indeterminate="true"         android:visibility="visible" /> 

If you would like an Horizontal progress bar use:

  <ProgressBar         style="@style/Base.Widget.AppCompat.ProgressBar.Horizontal"         android:layout_width="match_parent"         android:layout_height="8dp"         android:layout_marginTop="24dp"         android:indeterminate="true"         android:visibility="visible" /> 

They follow the official material guidelines.

like image 52
Gabriele Mariotti Avatar answered Oct 19 '22 14:10

Gabriele Mariotti