0

I've created circular progressbar spinner. I need to circulate my progress bar every time from the same place. Now it ends and begins from the different place of the circle. Please help me to solve my problem.

    <ProgressBar
    style="?android:attr/progressBarStyle"
    android:layout_width="70dp"
    android:layout_height="70dp"
    android:id="@+id/progressBar2"
    />
Butterfly
  • 445
  • 1
  • 9
  • 22
  • https://stackoverflow.com/questions/27213381/how-to-create-circular-progressbar-in-android. have a look over on this link you might get your answer from this link. – Shahzad Afridi Sep 30 '17 at 11:15

2 Answers2

0

See the link.

enter link description here

In the example

   <ProgressBar
  style="?android:attr/progressBarStyleLarge"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:id="@+id/progressBar"
  android:progressDrawable="@drawable/circular_progress_bar"
  android:layout_below="@+id/button"
  android:layout_alignRight="@+id/textView"
  android:layout_alignEnd="@+id/textView"
  android:layout_alignLeft="@+id/textview"
  android:layout_alignStart="@+id/textview"
  android:layout_alignParentBottom="true" />
Ronald Coarite
  • 4,460
  • 27
  • 31
0

Here is the link to full code... http://demonuts.com/2017/01/02/android-circular-progress-bar-percentage/

Copy and paste following code into circular.xml

<?xml version="1.0" encoding="utf-8"?>

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@android:id/secondaryProgress">
        <shape
            android:innerRadiusRatio="6"
            android:shape="ring"
            android:thicknessRatio="20.0"
            android:useLevel="true">


            <gradient
                android:centerColor="#999999"
                android:endColor="#999999"
                android:startColor="#999999"
                android:type="sweep" />
        </shape>
    </item>

    <item android:id="@android:id/progress">
        <rotate
            android:fromDegrees="270"
            android:pivotX="50%"
            android:pivotY="50%"
            android:toDegrees="270">

            <shape
                android:innerRadiusRatio="6"
                android:shape="ring"
                android:thicknessRatio="20.0"
                android:useLevel="true">


                <rotate
                    android:fromDegrees="0"
                    android:pivotX="50%"
                    android:pivotY="50%"
                    android:toDegrees="360" />

                <gradient
                    android:centerColor="#00FF00"
                    android:endColor="#00FF00"
                    android:startColor="#00FF00"
                    android:type="sweep" />

            </shape>
        </rotate>
    </item>
</layer-list>

Copy and paste following in activity_main.xml

<ProgressBar

        android:id="@+id/circularProgressbar"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="250dp"
        android:layout_height="250dp"
        android:indeterminate="false"
        android:max="100"
        android:progress="50"
        android:layout_centerInParent="true"
        android:progressDrawable="@drawable/circular"
        android:secondaryProgress="100"
        />
Shahzad Afridi
  • 2,058
  • 26
  • 24