I'm trying to make a circular progress bar on android and it seems pretty straightforward task , but I'm struggling with rounding the edges of the progress and secondary progress.
Is there a way to do that without making a custom view ? Using a corners radius ? or nine patch drawable ?
For this view (see attachement) I'm using a simple xml file
<item android:id="@android:id/progress">
<shape
android:useLevel="true"
android:innerRadius="@dimen/sixty_dp"
android:shape="ring"
android:thickness="@dimen/seven_dp">
<solid android:color="#477C5B"/>
<stroke android:width="1dip"
android:color="#FFFF"/>
</shape>
</item>
Just create class called
MyProgress
in your package .. and paste the following code..and add the following line in res->values->attr.xml under a tag and build it
that's it .... and to use in your layout ..
You can also change all property progrmatically using setMethods()...
feel free to ask anything .. best of luck
[Update 23-01-2016]
finally I uploaded code on github. You can refer it from here https://github.com/msquare097/MProgressBar
Now You can use this ProgressBar by simply writing following line in your app build.gradle file. You don't have to copy above code.
you can add a circle/oval shape on the end & begin side of the ring, just like the below code
a layer-list drawable contain two circle/oval shape drawable and a ring shape drawable
round_progress_drawable.xml
round_progress_animation_selector.xml
activity_main.xml