Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • How to make Custom Circle Progress bar in android?

    • 0
    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 4.76k
    Comment on it

    In the below example code I have created a Custom Circle Progress bar. Here first I have added Progress bar layout within activity_main.xml then I have created a new circular_progressbar.xml file in a drawable folder. In circular_progress bar.xml I have used rotate XML this rotate allows our form to rotate from 0 to 360 degrees. And I have also used shape.xml for creating a stylish progress bar, In shape.xml I have used these attributes- color, innerRadius, shape, useLevel and thickness.

    For the ring you must set the following parameters:-

    android:innerRadiusRatio – For using an inner radius of the ring

    android:thicknessRatio – For using thickness of the ring

    android:useLevel="true" – Indicates whether the progress bar level affects .

     

    Step(1) activity_main.xml layout-

     <ProgressBar
            android:background="@color/center"
            android:indeterminate="true"
            android:layout_gravity="center"
            style="?android:attr/progressBarStyleLarge"
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:layout_centerInParent="true"
            android:indeterminateDrawable="@drawable/circular_progressbar" />


     

    Step(2)-Created circular_progressbar.xml in drawable folder-
     

    <rotate xmlns:android="http://schemas.android.com/apk/res/android"
        android:fromDegrees="0"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toDegrees="360">
        <shape
        android:innerRadiusRatio="4"
        android:shape="ring"
        android:useLevel="true"
        android:thickness="2dp">
        <solid android:color="@color/colorPrimaryDark"/>
        </shape>
    </rotate>
    
    
    
    Android Custom Progressbar

 1 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: