![]() |
VOOZH | about |
State Progress Bar is one of the main features that we see in many applications. We can get to see this feature in ticket booking apps, educational apps. This progress bar helps to tell the user the steps to be carried out for performing a task. In this article, we are going to see how to implement State Progress Bar in Android.
Attributes | Description |
|---|---|
| layout_width | Use for giving specific width. |
| layout_height | Use for giving specific height. |
| spb_maxStateNumber | Use to display the number of states used in the app. |
| spb_currentStateNumber | Use to display the current state. |
| spb_stateBackgroundColor | Use to display background color. |
| spb_stateForegroundColor | Use to display Foreground color. |
| spb_animateToCurrentProgressState | Gives Animation to the current Progress state. |
| spb_checkStateCompleted | Check whether the state is completed or not. |
To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio.
Navigate to Gradle Scripts > build.gradle.kts(Module :app) and add the following dependency under the dependencies {} section.
dependencies {
...
implementation ("com.github.kofigyan:StateProgressBar:69b4192777") {
exclude(group = "com.android.support", module = "support-v4")
}
}
Navigate to Gradle Scripts > settings.gradle.kts and add the following code under the repositories{} section.
dependencyResolutionManagement {
...
repositories {
...
maven { url = uri("https://jitpack.io/") }
}
}
Navigate to Gradle Scripts > gradle.properties and add the following code at the end.
android.enableJetifier=trueNow click on Sync now.
Navigate to the app > res >layout > activity_main.xml file. Below is the code for the activity_main.xml file.
activity_main.xml:
Go to the MainActivity file and refer to the following code. Below is the code for the MainActivity file. Comments are added inside the code to understand the code in more detail.