Skip to content Skip to sidebar Skip to footer

Progressbar(dialog) Inside A Button Android

Can someone suggest how to implement progress dialog inside a Button for example , when I click on submit Button then progress dialog occurs inside Button for showing loading I don

Solution 1:

You may go with Nilesh answer or if you're not willing to use third party lib, it is quite easy to write your own. All you have to do is to create a custom view extending RelativeLayout or FrameLayout.

This link might might help.

Solution 2:

See this link for Progress Button library

Include Progress Button in your layout like this

 <com.dd.processbutton.iml.ActionProcessButton
            android:id="@+id/btnSignIn"
            android:layout_width="match_parent"
            android:layout_height="48dp"
            android:layout_marginBottom="16dp"
            android:text="@string/Sign_in"
            android:textColor="@android:color/white"
            android:textSize="18sp"
            custom:pb_colorComplete="@color/green_complete"
            custom:pb_colorNormal="@color/blue_normal"
            custom:pb_colorPressed="@color/blue_pressed"
            custom:pb_colorProgress="@color/purple_progress"
            custom:pb_textComplete="@string/Success"
            custom:pb_textProgress="@string/Loading" />

Solution 3:

You can use this library: https://github.com/dmytrodanylyk/circular-progress-button

Just add this to build.gradle:

dependencies {
    compile'com.github.dmytrodanylyk.circular-progress-button:library:1.1.3'
}

And then you can use this code in your .xml:

<com.dd.CircularProgressButton
        android:id="@+id/circularButton1"
        android:layout_width="196dp"
        android:layout_height="64dp"
        android:textColor="@color/cpb_white"
        android:textSize="18sp"
        app:cpb_cornerRadius="48dp"
        app:cpb_iconComplete="@drawable/ic_action_accept"
        app:cpb_iconError="@drawable/ic_action_cancel"
        app:cpb_textIdle="@string/Upload" />

Post a Comment for "Progressbar(dialog) Inside A Button Android"