|
1 | | -# LoadingButton |
| 1 | +# LoadingButton |
| 2 | +A lightweight library to show loading animation inside a button |
| 3 | + |
| 4 | +[](https://jitpack.io/v/droidbond/LoadingButton) |
| 5 | + |
| 6 | +## Installation (with Gradle) |
| 7 | +Just add the dependency to your *build.gradle*: |
| 8 | + |
| 9 | +```groovy |
| 10 | + repositories { |
| 11 | + jcenter() |
| 12 | + maven { url "https://jitpack.io" } |
| 13 | + } |
| 14 | + dependencies { |
| 15 | + implementation 'com.github.droidbond:LoadingButton:0.1.0' |
| 16 | + } |
| 17 | +``` |
| 18 | +### How to use |
| 19 | +Inside xml layout |
| 20 | +```xml |
| 21 | + <com.didar.loadingbutton.LoadingButton |
| 22 | + android:layout_width="wrap_content" |
| 23 | + android:layout_height="wrap_content" |
| 24 | + android:id="@+id/normal" |
| 25 | + app:layout_constraintTop_toTopOf="parent" |
| 26 | + app:layout_constraintStart_toStartOf="parent" |
| 27 | + android:layout_marginTop="28dp" |
| 28 | + app:layout_constraintEnd_toEndOf="parent" |
| 29 | + android:layout_marginEnd="8dp" |
| 30 | + android:layout_marginRight="8dp" |
| 31 | + android:layout_marginLeft="8dp" |
| 32 | + android:layout_marginStart="8dp"/> |
| 33 | +``` |
| 34 | +### Customizable attributes |
| 35 | +```xml |
| 36 | + <attr name="text" format="string"/> |
| 37 | + <attr name="textColor" format="color"/> |
| 38 | + <attr name="boldText" format="boolean"/> |
| 39 | + <attr name="textSize" format="dimension"/> |
| 40 | + <attr name="progressColor" format="color"/> |
| 41 | + <attr name="background" format="reference"/> |
| 42 | + <attr name="progressBarSize" format="enum"> |
| 43 | + <enum name="large" value="64"/> |
| 44 | + <enum name="medium" value="48"/> |
| 45 | + <enum name="small" value="18"/> |
| 46 | + </attr> |
| 47 | +``` |
| 48 | +### Show Loading |
| 49 | +```java |
| 50 | +custombtn.showLoading() |
| 51 | +``` |
| 52 | +### Hide Loading |
| 53 | +```java |
| 54 | +custombtn.hideLoading() |
| 55 | +``` |
| 56 | + |
| 57 | +For a complete example see the sample app https://github.com/droidbond/LoadingButton/tree/master/app |
0 commit comments