Skip to content

A very simple progress view, ProgressView extends View, you can custom the circular ring's colors and size, and use the methods in View. 一个可以调节颜色和线条粗细的环形进度条控件

License

Notifications You must be signed in to change notification settings

Runly/CircularProgressView

Repository files navigation

CircularProgressView

A very simple progress view, ProgressView extends View, you can custom the circular ring's colors and size, and use the methods in View.

Demo

  • This gif's speed is little faster than really.

Usage

  • Add it in your root build.gradle at the end of repositories:

    allprojects {
        repositories {
            ...
            maven { url "https://jitpack.io" }
        }
    }
    
  • Add it in your app build.gradle at the end of dependencies:

    dependencies {
        compile 'com.github.Runly:CircularProgressView:v2.0.0'
    }
    
XML
    <com.github.runly.circularprogressview.ProgressView
    android:id="@+id/progress_view"
    android:layout_width="100dp"
    android:layout_height="100dp" />
Java
    ProgressView progress1 = (ProgressView) findViewById(R.id.progress1);
    //set the stroke size with dp
    progress1.setStrokeSizeDp(mContext, 5); 
    //set the color
    progress1.setStrokeColors(new int[] {Color.BLUE});
    
    ProgressView progress2 = (ProgressView) findViewById(R.id.progress2);
    //set the stroke size with px
    progress2.setStrokeSizePx(15);
    //set the colors
    progress2.setStrokeColors(new int[] {Color.BLUE, Color.RED, Color.GREEN, Color.YELLOW});
    
You can also use ProgressView without XML
    
    ProgressView progressView = new ProgressView(mContext, null);
    progressView.setStrokeSizeDp(context, 20);
    progressView.setStrokeColors(new int[] {Color.WHITE});
    

More

Three methods
  • start()

means start and Display the progress view

    progress = (ProgressView) findViewById(R.id.progress);
    /*   xxxxxxx   */
    progress.start();

In default casa, if you initialize a ProgressView, it will auto start, you needn't call start().

  • setAutoStart(boolean isAutoStart)

If you don't want it auto start, you can call this method.

    progress = (ProgressView) findViewById(R.id.progress);
    /*   xxxxxxx   */
    progress.setAutoStart(false);
  • stop()

means stop and disappear the progress view

    progress = (ProgressView) findViewById(R.id.progress);
    /*   xxxxxxx   */
    progress.stop();

About

A very simple progress view, ProgressView extends View, you can custom the circular ring's colors and size, and use the methods in View. 一个可以调节颜色和线条粗细的环形进度条控件

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages