Create circular progressBar in android
Switch branches/tags
Nothing to show
Clone or download
lopspower Update README.md
Add demo app
Latest commit a805979 Jul 18, 2018

README.md

CircularProgressBar

sample

License Platform API
Android Arsenal Twitter

This is an Android project allowing to realize a circular ProgressBar in the simplest way possible.

Android app on Google Play

USAGE

To make a circular ProgressBar add CircularProgressBar in your layout XML and add CircularProgressBar library in your project or you can also grab it via Gradle:

implementation 'com.mikhaellopez:circularprogressbar:2.0.0'

XML

<com.mikhaellopez.circularprogressbar.CircularProgressBar
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:cpb_background_progressbar_color="#FFCDD2"
    app:cpb_background_progressbar_width="5dp"
    app:cpb_progressbar_color="#F44336"
    app:cpb_progressbar_width="10dp" />

You must use the following properties in your XML to change your CircularProgressBar.

Properties:
  • app:cpb_progress (integer) -> default 0
  • app:cpb_progress_max (integer) -> default 100
  • app:cpb_indeterminate_mode (boolean) -> default false
  • app:cpb_progressbar_color (color) -> default BLACK
  • app:cpb_background_progressbar_color (color) -> default GRAY
  • app:cpb_progressbar_width (dimension) -> default 7dp
  • app:cpb_background_progressbar_width (dimension) -> default 3dp

JAVA

CircularProgressBar circularProgressBar = (CircularProgressBar)findViewById(R.id.yourCircularProgressbar);
circularProgressBar.setColor(ContextCompat.getColor(this, R.color.progressBarColor));
circularProgressBar.setBackgroundColor(ContextCompat.getColor(this, R.color.backgroundProgressBarColor));
circularProgressBar.setProgressBarWidth(getResources().getDimension(R.dimen.progressBarWidth));
circularProgressBar.setBackgroundProgressBarWidth(getResources().getDimension(R.dimen.backgroundProgressBarWidth));
int animationDuration = 2500; // 2500ms = 2,5s
circularProgressBar.setProgressWithAnimation(65, animationDuration); // Default duration = 1500ms

LICENCE

CircularProgressBar by Lopez Mikhael is licensed under a Apache License 2.0. Based on a work at https://github.com/Pedramrn/CircularProgressBar.