0

Create Material Design Circular ProgressBar in android on all devices

 How to add Show Circular Progress bar inside android app and all pre lollipop devices programmatically.

Material design circular progress bar is more attractive then the older progress bar which shows in older android versions pre from lollipop. After coming the android lollipop version it will automatically converts the old P-bar to new material style P-bar, But for older devices there are no such progress bar available. After searching lot on internet finally i found GitHub library which will enable us to Create Material Design Circular ProgressBar in android on all devices.

android-project-download-code-button

Please follow all the below steps:

1.Open your project’s build.gradle ( Module : app ) file.

build-gradle-app

2. Please add below code inside your build.gradle ( Module : app ) file.

compile 'com.android.support:appcompat-v7:23.4.0'

compile 'com.android.support:design:23.1.0'

compile 'com.github.rey5137:material:1.2.2'

3. Screenshot of build.gradle ( Module : app ) file after adding above code.

material-github

Here you go now its time to start coding .

How to Create Material Design Circular ProgressBar in android on all devices.

Code for MainActivity.java file.

package com.android_examples.materialdesigncircularprogressbar_android_examplescom;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

Code for activity_main.xml layout file.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    >

    <com.rey.material.widget.ProgressView
        android:layout_width="48dp"
        android:layout_height="48dp"
        app:pv_autostart="true"
        app:pv_circular="true"
        app:pv_progressStyle="@style/Material.Drawable.CircularProgress"
        app:pv_progressMode="indeterminate"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="54dp"
        android:indeterminate="false"
        />

</RelativeLayout>

Screenshot:

Create Material Design Circular ProgressBar in android on all devices

Click here to download Create Material Design Circular ProgressBar in android on all devices project with source code.

Leave a Reply

Your email address will not be published. Required fields are marked *