LoadingButton
A lightweight library to show loading animation inside a button.
Installation (with Gradle)
Add the dependency to your root build.gradle:
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
Now add this dependency in your module build.gradle
dependencies {
implementation 'com.github.droidbond:LoadingButton:0.1.5'
}
Demo
How to use
For using custom attributes use app
namespace
xmlns:app="http://schemas.android.com/apk/res-auto"
<com.droidbond.loadingbutton.LoadingButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/normal"
app:text="@string/continue_text"
app:textColor="@color/white"
app:progressColor="@color/black"
app:progressBarSize="small"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="28dp"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"/>
Customizable attributes
<attr name="text" format="string"/>
<attr name="textColor" format="color"/>
<attr name="boldText" format="boolean"/>
<attr name="textSize" format="dimension"/>
<attr name="progressColor" format="color"/>
<attr name="customFontFamily" format="reference"/>
<attr name="background" format="reference"/>
<attr name="progressBarSize" format="enum">
<enum name="large" value="64"/>
<enum name="medium" value="48"/>
<enum name="small" value="18"/>
</attr>
LoadingButton custombtn = findViewById(R.id.custombtn);
Show Loading
custombtn.showLoading()
Hide Loading
custombtn.hideLoading()
Show Success
custombtn.showSuccess()
Show Error
custombtn.showError()
Loading?
custombtn.isLoading()