How to create CircularProgressBar like below where you can stop the progressbar by taping on cross image.
Asked
Active
Viewed 3,637 times
-1
-
https://github.com/Adilhusen/circle-progress-ad-android – Adil Feb 18 '19 at 05:37
2 Answers
2
You can use this library CircleProgress . It is easy to use. Here is stages:
Add this gradle file
compile 'com.github.lzyzsd:circleprogress:1.1.0@aar'
Here is xml file
<com.github.lzyzsd.circleprogress.DonutProgress
android:layout_marginLeft="50dp"
android:id="@+id/donut_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
custom:donut_progress="30"/>
For more information visit here

Community
- 1
- 1

Md. Sajedul Karim
- 6,749
- 3
- 61
- 87
0
create a progressbar tag in your layout :
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="100dp"
android:layout_height="100dp"
android:max="100"
android:progress="0"
android:progressDrawable="@drawable/circular" />
and create a circular.xml drawable :
<shape
android:innerRadiusRatio="2"
android:shape="ring"
android:thickness="2sp" >
<solid android:color="@color/colorPrimary" />
</shape>
for API >= 21 add android:useLevel="true"
to the shape tag in circular.xml.
then in your Activity you would just have to set the progressBar progress depending on current progress and for the cancel button you can just add a button to cancel where you like.

Amr El Aswar
- 3,395
- 3
- 23
- 36
-
-
@WaleedSarwar if you are using API>= 21 add `android:useLevel="true"` to the `
` tag in circular.xml – Amr El Aswar May 15 '16 at 12:40 -
-
well I just tested it on kitkat and lolipop and marshmallow and they all work :/ have you programitcally set the proggress of the progressbar? if you leave the progress at 0 you wont see the progressbar, set the progress to 20 or something else and you will see it works. – Amr El Aswar May 15 '16 at 13:03
-
yes you are right its working now.But as you can see in the picture i want indeterminate mode of the progressbar. – waleedsarwar86 May 15 '16 at 13:09
-
@WaleedSarwar if you just want an indeterminate progressbar then remove the `style="?android:attr/progressBarStyleHorizontal"` and add `android:indeterminate="true"` then you can programatically switch between indeterminate and determinate progress in your activity. – Amr El Aswar May 15 '16 at 13:23
-
Yes i have tried it but the color progressDawable is not changing. – waleedsarwar86 May 15 '16 at 13:26
-
@WaleedSarwar I am having trouble keeping up with what you want exactly, do you just want an indeterminate progressbar with color of choice? – Amr El Aswar May 15 '16 at 13:31
-
Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/111982/discussion-between-waleed-sarwar-and-amro-elaswar). – waleedsarwar86 May 15 '16 at 13:33