15

I have a horizontal ProgressBar that works great.

  <ProgressBar
                android:id="@+id/progressBar1"
                style="?android:attr/progressBarStyle"
                android:layout_width="match_parent"
                android:layout_height="15dp"
                android:layout_marginBottom="5dp"
                android:background="@drawable/progress_radial_background"
                android:progressDrawable="@drawable/custom_progress_bar" />

I do this:

pb.setMax(100);
pb.set(point);

And it shows the status of a user's level. When it fills all the way, they reach a new level and it starts over. It will only move/increase when the user do some action to increase points.

However, I'd like to make this circular instead of horizontal. But when I do, it wont stop the spinning animation (like a loading animation). Can I make the circular ProgressBar the same way?

Custom Progress Bar code in my Drawable folder:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item
        android:id="@android:id/background"
        android:drawable="@drawable/list_press">
        <corners android:radius="6dp" />
    </item>
    <item android:id="@android:id/progress">
        <clip android:drawable="@drawable/progress_bar_green" />
    </item>
</layer-list>
BSMP
  • 4,596
  • 8
  • 33
  • 44
TheLettuceMaster
  • 15,594
  • 48
  • 153
  • 259
  • paste your `custom_progress_bar` – Varun Jun 14 '13 at 18:39
  • and is there any other xml-drawable? one of those would be having a rotate attribute. – Varun Jun 15 '13 at 03:01
  • No. My current indicator is horizontal. I'm trying to do same thing but radial. Also it had to have no animation. Its based on a %. Max is 100 and bar had to be set to a value 1 - 100. – TheLettuceMaster Jun 15 '13 at 03:44
  • 4
    ok so now I get it. AFAIK the circular progress bar is only indeterminate purposes, that is, when you dont know when the long running task will complete,. IMO you cannot use the stock progress bar (circular/radial) to display any percentage progress. – Varun Jun 18 '13 at 17:11

3 Answers3

15

There is no standard Android widget that does what you want.

However you could use this library that does it: https://github.com/Todd-Davies/ProgressWheel.

BoD
  • 10,838
  • 6
  • 63
  • 59
5

This poster seems to have found an answer.

It seems like they took the android drawables for the circular progress bar and filling, specified in xml layout that it was a horizontal progress bar and made it determinate.

Community
  • 1
  • 1
mpellegr
  • 3,072
  • 3
  • 22
  • 36
3

Please take a look to this GitHub library called RefreshActionItem, I think it is exactly what you are looking for:

https://github.com/ManuelPeinado/RefreshActionItem?source=cc

You have as well this one for another idea or just check it out:

https://github.com/f2prateek/progressbutton?source=c

jpardogo
  • 5,636
  • 2
  • 23
  • 27