Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a Radial/Circular ProgressBar Not Spin

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>
like image 785
TheLettuceMaster Avatar asked Jun 13 '13 02:06

TheLettuceMaster


2 Answers

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.

like image 96
BoD Avatar answered Oct 21 '22 04:10

BoD


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.

like image 36
mpellegr Avatar answered Oct 21 '22 05:10

mpellegr