Erik77
Erik77

Reputation: 109

How to make a filled circular progress bar? (without using external libraries)

I want to make a circular filled progress bar in Android Studio. My goal is to achieve something like this;

Example image

The first image would have the progress value of for example, 100, then every second a bit of the circle will disappear until its nothing left.

I tried this but I couldn't get my repositories to work, therefore I'm looking for a more "non external" way to do it.

Upvotes: 1

Views: 739

Answers (1)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 363707

With the Material Components library you can use the official CircularProgressIndicator.
Something like:

<com.google.android.material.progressindicator.CircularProgressIndicator
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:trackThickness="20dp"    
                />

enter image description here

If you are using jetpack Compose you can use CircularProgressIndicator:

CircularProgressIndicator(
    strokeWidth = 20.dp, 
    progress = animatedProgress.value)

enter image description here

Upvotes: 2

Related Questions