/DashedProgressBar

Android Dashed Line Progress Bar

Primary LanguageKotlinApache License 2.0Apache-2.0

DashedProgressBar

To use this add below lines in your project level gradle

allprojects {
	repositories {
	    ...
		maven { url 'https://jitpack.io' }
	}
}

Further add this in your app level

dependencies {
	 implementation 'com.github.shaan8905:DashedProgressBar:Tag'
}

To customize the progress bar you can use below attributes

Attributes Type
sp_progressColor color
sp_bgColor color
sp_stokeWidth float
sp_progressWidth float
sp_dashedWidth float

To use this in your xml use it like below

<com.shahnavaz.dashedprogress.customProgress.CustomLineDashedProgressBarView
        android:id="@+id/progressBar"
        android:layout_width="match_parent"
        android:layout_marginHorizontal="30dp"
        android:layout_height="40dp"
        android:layout_gravity="center"
        app:sp_progressWidth="30.0"
        app:sp_dashedWidth="10.0"
        app:sp_stokeWidth="10.0"
        app:sp_bgColor="@color/black"
        app:sp_progressColor="@color/purple_500" />

Now set progress programmatically

val progress = findViewById<CustomLineDashedProgressBarView>(R.id.progressBar)
progress.setProgress(70.0f)

If you want to animate your progress bar with delay you can achive it by this

val progressBar2 = findViewById<CustomLineDashedProgressBarView>(R.id.progressBar2)
progress.setProgress(70.0f)
val animation = ValueAnimator.ofFloat( 0f, 100f);
animation.addUpdateListener {
    progressBar2.setProgress(it.animatedValue as Float)
}
animation.duration = 5000L;
animation.interpolator = LinearInterpolator();
animation.start();

Output

Output Gif File

Buy Me A Coffee

Happy Coding