Search code examples
androidkotlinprogress-barandroid-progressbar

How to create custom progressbar with indicator points using Kotlin


I am trying to build a multiple step registration form where in each step the user enters some data and clicks next/previous button to go to the next/previous step. I am implementing this using Fragments for the steps and ViewPager2 for managing the steps.

I am trying to implement a custom linearprogressbar on top of each step to indicate the step user is currently on.

This is the reference layout of the progressbar I want to achieve.

I am quite new in android development and would like to know how can I implement this. Is there any possible modification/property of existing progressbar to achieve this or do I need to create a custom view class. If so, how can I create this class and implement it inside a fragment/activity?

I have tried ChatGPT, Bard and searching on the Internet to look for resources which could help me get the result. But since I'm new in this sea, I could not find anything useful and the bugful code that I the AIs gave me, it got my head spinning.


Solution

  • This is called stepper in android. You can use following library to implement your registration form.

    https://github.com/acefalobi/android-stepper