Question

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>
Était-ce utile?

La solution

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.

Autres conseils

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.

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top