VOOZH about

URL: https://www.geeksforgeeks.org/android/state-progressbar-in-android/

⇱ State ProgressBar in Android - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

State ProgressBar in Android

Last Updated : 23 Jul, 2025

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.

Application of State Progress Bar

  • Used in most of the service providing applications such as ticket booking, exam form filling, and many more.
  • This State Progress Bar helps the user's steps to be carried out for performing the task.
  • Use in various exam form-filling applications.

Attributes of State Progress Bar

Attributes

Description

layout_widthUse for giving specific width.
layout_heightUse for giving specific height.
spb_maxStateNumberUse to display the number of states used in the app.
spb_currentStateNumberUse to display the current state.
spb_stateBackgroundColorUse to display background color.
spb_stateForegroundColorUse to display Foreground color.
spb_animateToCurrentProgressStateGives Animation to the current Progress state.
spb_checkStateCompletedCheck whether the state is completed or not. 


Step by Step Implementation

Step 1: Create a New Project

To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio.

Step 2: Add dependency

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=true

Now click on Sync now.


Step 3: Create a new State Progress Bar in your activity_main.xml file

Navigate to the app > res >layout > activity_main.xml file. Below is the code for the activity_main.xml file.

activity_main.xml:


Step 4: Working with the MainActivity file

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.


Output:

Comment

Explore