How to make a Radial/Circular ProgressBar Not Spin
Asked Answered
P

3

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>
Pitts answered 13/6, 2013 at 2:39 Comment(4)
paste your custom_progress_barNonplus
and is there any other xml-drawable? one of those would be having a rotate attribute.Nonplus
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.Pitts
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.Nonplus
B
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.

Barter answered 24/6, 2013 at 16:52 Comment(0)
S
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.

Squirrel answered 25/6, 2013 at 15:51 Comment(0)
A
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

Addict answered 26/6, 2013 at 23:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.