How to create an arc shaped progress bar in Android?

Viewed 4392

I'm trying to create a progress bar like the following image.

My requirements are: 1. I want to be able to set a progress value to it programmatically. 2. I want to be able to change the colors of the arc - both the background one (grey) and the foreground one (green).

I looked into libraries but found none that do it in this particular shape and style. I am not proficient enough in creating custom drawables to be able to create this by myself. Any help is appreciated!

enter image description here

2 Answers

In addition to the above answer, you can also use CircleProgress which seems to have something that looks exactly like your use case:

enter image description here

Usage:

<com.github.lzyzsd.circleprogress.ArcProgress
    android:id="@+id/arc_progress"
    android:background="#214193"
    android:layout_marginLeft="50dp"
    android:layout_width="100dp"
    android:layout_height="100dp"
    custom:arc_progress="55"
    custom:arc_bottom_text="MEMORY"/>

Also, if you check the license on this library (bottom of their README), it seems like it's very favorable to using it however you wish.

You can use SeekArc. It can do everything you need to get that result.

It would look something like this

<com.triggertrap.seekarc.SeekArc
    android:id="@+id/seekArc"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:padding="30dp"
    seekarc:rotation="180"
    seekarc:startAngle="30"
    seekarc:sweepAngle="300"
    seekarc:arcColor="@color/grey"
    seekarc:progressColor="@color/green"
    seekarc:touchInside="true" />
Related