Build Custom Dotted Progress bar in Android

Sourabh Gupta
2 min readAug 20, 2019

--

ProgressBar is a common pattern in Android to show loading. But more often than not, building a smooth animating progress bar becomes a hassle. Many libraries out there for Dotted Progress bar makes the dot jump without any transition animation which makes the loading screen looks less appealing.

While finding one such progress bar for my own app. I was having a bit of problem. There were some libraries I found on GitHub for this issue but those were too rigid and complicated to modify. So, i built a fully customizable animated dotted progress bar to address this need and help android developers who face the similar issue.

Here is the basic sample of how to use the library:-

<com.example.dotprogressbar.DotProgressBar
android:layout_width="match_parent"
android:layout_height="match_parent"/>

Simply add the progress bar in xml and you are done. All things from animation to number of dots to dot’s shape and progress bar orientation and direction are customizable.

Here’s is a sample code how you can do all this from kotlin code:-

val dotProgressBar = DotProgressBar.Builder()
.setMargin(4)
.setAnimationDuration(2000)
.setDotBackground(R.drawable.ic_launcher_background)
.setMaxScale(1f)
.setMinScale(0.3f)
.setNumberOfDots(5)
.setdotRadius(8)
.build(this)
frame_layout.addView(dotProgressBar)
dotProgressBar.startAnimation()

That’s it. And now you will have a fully functional dotted animated progress bar.You can just change a simple animation and it will result in a completely different progress bar. Here is the same progress bar with bounce animation.

That’s all for now. Here is the GitHub link to the project.

Fork me on GitHub

Check out the complete source code in the following link:

https://github.com/sourabhgupta811/DotProgressBar
https://www.linkedin.com/in/sourabhgupta811/

--

--

Sourabh Gupta
Sourabh Gupta

No responses yet