A circular android ProgressBar library which extends View, and the usage same as ProgressBar, It has solid,line and solid_line three styles. Besides, progress value can be freely customized.

Last update: Aug 10, 2022

CircleProgressBar

中文版文档   

The CircleProgressBar extends View, It has both solid and line two styles. Besides, progress value can be freely customized. If you are interested in cool loading animations, you can see LoadingDrawable.

Usage

Gradle

dependencies {
   compile 'com.dinuscxj:circleprogressbar:1.3.6'
}

Used in xml:

<com.dinuscxj.progressbar.CircleProgressBar
	android:id="@+id/line_progress"
	android:layout_marginTop="@dimen/default_margin"
	android:layout_width="50dp"
	android:layout_height="50dp" />

Attributes

There are several attributes you can set:

The progress style:

  • line (default)
  • solid_line
  • solid

The progress text:

  • text color
  • text size
  • visibility
  • format

The progress circle:

  • width
  • start degree
  • start color
  • end color
  • background color
  • draw background outside progress

The progress shader

  • linear (default,but if start_color and end_color equivalence, will not set the shader)
  • radial
  • sweep

The progress blur (blur radius must larger than zero)

  • normal (default)
  • solid
  • outer
  • inner

The progress stroke cap

  • butt (default)
  • round
  • square

The line style:

  • width
  • count

for example : In the xml

<com.dinuscxj.progressbar.CircleProgressBar
	android:layout_width="50dp"
	android:layout_height="50dp"

	app:progress_style="line"
	
	app:background_color="@color/holo_red_light"

	app:progress_text_color="@color/holo_purple"
	app:progress_text_size="@dimen/progress_text_size"

	app:progress_stroke_width="1dp"
	app:progress_start_color="@color/holo_purple"
	app:progress_end_color="@color/holo_green_light"
	app:progress_background_color="@color/holo_darker_gray"
	app:progress_start_degree="-90"
	app:drawBackgroundOutsideProgress="true"

	app:progress_shader="sweep"
    
	app:progress_stroke_cap="round"
	
	app:progress_blur_style="solid"
	app:progress_blur_radius="5dp"

	app:line_width="4dp"
	app:line_count="30"/>

format progress

     private static final class MyProgressFormatter implements ProgressFormatter {
         private static final String DEFAULT_PATTERN = "%d%%";
 
         @Override
         public CharSequence format(int progress, int max) {
             return String.format(DEFAULT_PATTERN, (int) ((float) progress / (float) max * 100));
         }
     }
     
     // set the ProgressFormatter as you want
     CircleProgressBar.setProgressFormatter(new MyProgressFromatter);
     // hide the progress
     CircleProgressBar.setProgressFormatter(null);
     

Advantages

  1. extends View, do not care to save the current state of progress, CircleProgressBar has written in to help us in onSaveInstanceState () and onRestoreInstanceState (Parcelable state).
  2. highly customizable, you can set the two styles of progress bar, you can set the color of the bars, you can set the color and size of the progress of the text, due to the progress of the code for formatting text uses String.format (), so progress text can be customized as needed
  3. Code elegant, very comprehensive code comments, neat format, you can set the relevant properties directly in xml.

About me

I like Android, like open source, and like doing something interesting. :) If you like CircleProgressBar or use it, you can star this repo and send me some feedback. Thanks! _ QQ Group: 342748245

License

Copyright 2015-2019 dinuscxj

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

GitHub

https://github.com/dinuscxj/CircleProgressBar
Comments
  • 1. Is it possible to make only the progress_background_color behind the stroke color transparent and the rest of the progress_background_color colored?

    Thanks for such a nice library, I have used it in many projects. I want to set the only the background color behind the stroke color transparent and the rest as it is.

    Thank you in advance.

    Reviewed by sharmanirudh at 2018-07-19 23:20
  • 2. setProgressBackgroundColor(), setProgressStartColor(), setProgressEndColor() do not seem to be working

    Hi @dinuscxj, thanks for this nice library. However, I think that setProgressBackgroundColor(), setProgressStartColor(), setProgressEndColor() are not working. I am trying to set color like this:

    mCircleProgressBar.setDrawBackgroundOutsideProgress(true);
    mCircleProgressBar.setProgressBackgroundColor(R.color.colorCircularProgressBarBackground);
    mCircleProgressBar.setProgressStartColor(R.color.colorBlack);
    mCircleProgressBar.setProgressEndColor(R.color.colorBlack);
    

    Thanks in advance.

    Reviewed by dhinchakrajat at 2018-07-26 04:31
  • 3. set indeterminate to true not working

    Thanks for great library. After search a lot, I found this. But now I want to use animation for progressbar, like indeterminate. When set indeterminate to true, not working. Why ? I want to implementation progressbar like Telegram app. Thanks again bro.

    Reviewed by Sirvanalie at 2017-12-31 07:15
  • 4. Not drawing progress with Android sdk version 29

    I update sdk version in app gradle

    compileSdkVersion 29
        buildToolsVersion '29.0.3'
        defaultConfig {
            ...
            minSdkVersion 21
            targetSdkVersion 29
            ....
        }
    

    Previously was

    compileSdkVersion 28
        buildToolsVersion '28.0.3'
        defaultConfig {
            ...
            minSdkVersion 21
            targetSdkVersion 28
            ....
        }
    

    Now CircleProgressBar can't draw progress bar updates. I logged this:

     handleWindowVisibility: no activity for token [email protected]
     Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
     Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
     Accessing hidden field Lsun/misc/Unsafe;->theUnsafe:Lsun/misc/Unsafe; (greylist, reflection, allowed)
     Accessing hidden method Lsun/misc/Unsafe;->allocateInstance(Ljava/lang/Class;)Ljava/lang/Object; (greylist, reflection, allowed)
     mapper 3.x is not supported
     handleWindowVisibility: no activity for token [email protected]
     Accessing hidden field Landroid/widget/ProgressBar;->mOnlyIndeterminate:Z (greylist, reflection, allowed)
     Accessing hidden field Landroid/widget/ProgressBar;->mIndeterminate:Z (greylist-max-p, reflection, denied)
     java.lang.NoSuchFieldException: No field mIndeterminate in class Landroid/widget/ProgressBar; (declaration of 'android.widget.ProgressBar' appears in /system/framework/framework.jar!classes3.dex)
         at java.lang.Class.getDeclaredField(Native Method)
         at com.dinuscxj.progressbar.CircleProgressBar.adjustIndeterminate(CircleProgressBar.java:220)
         at com.dinuscxj.progressbar.CircleProgressBar.<init>(CircleProgressBar.java:111)
         at java.lang.reflect.Constructor.newInstance0(Native Method)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
         at android.view.LayoutInflater.createView(LayoutInflater.java:854)
         at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1006)
         at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
         at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123)
         at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
         at android.view.LayoutInflater.rInflate(LayoutInflater.java:1126)
         at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
         at android.view.LayoutInflater.rInflate(LayoutInflater.java:1126)
         at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
         at android.view.LayoutInflater.rInflate(LayoutInflater.java:1126)
         at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
         at android.view.LayoutInflater.inflate(LayoutInflater.java:682)
         at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
         at java.lang.reflect.Constructor.newInstance0(Native Method)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
         at android.view.LayoutInflater.createView(LayoutInflater.java:854)
         at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1006)
         at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
         at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123)
         at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
         at android.view.LayoutInflater.rInflate(LayoutInflater.java:1126)
         at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
         at android.view.LayoutInflater.rInflate(LayoutInflater.java:1126)
         at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
         at android.view.LayoutInflater.rInflate(LayoutInflater.java:1126)
         at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
         at android.view.LayoutInflater.inflate(LayoutInflater.java:682)
         at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
         at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2698)
         at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:310)
         at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1185)
         at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1354)
         at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1432)
         at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:442)
         at androidx.fragment.app.FragmentManager.executeOps(FragmentManager.java:2167)
         at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1990)
         at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1945)
         at androidx.fragment.app.FragmentManager.execSingleAction(FragmentManager.java:1816)
         at androidx.fragment.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:303)
         at androidx.fragment.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:262)
         at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1244)
         at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1092)
         at androidx.viewpager.widget.ViewPager.onMeasure(ViewPager.java:1622)
         at android.view.View.measure(View.java:26415)
         at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7845)
         at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
         at android.view.View.measure(View.java:26415)
         at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7845)
         at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
         at android.view.View.measure(View.java:26415)
         at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7845)
         at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
         at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)
         at android.view.View.measure(View.java:26415)
         at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7845)
         at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
         at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
         at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
         at android.view.View.measure(View.java:26415)
         at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7845)
         at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
         at android.view.View.measure(View.java:26415)
         at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7845)
         at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
         at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
         at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
         at android.view.View.measure(View.java:26415)
         at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7845)
         at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
         at com.android.internal.policy.DecorView.onMeasure(DecorView.java:1009)
         at android.view.View.measure(View.java:26415)
         at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:3605)
         at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:2348)
         at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2640)
         at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2200)
         at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8999)
         at android.view.Choreographer$CallbackRecord.run(Choreographer.java:996)
         at android.view.Choreographer.doCallbacks(Choreographer.java:794)
         at android.view.Choreographer.doFrame(Choreographer.java:729)
         at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:981)
         at android.os.Handler.handleCallback(Handler.java:883)
         at android.os.Handler.dispatchMessage(Handler.java:100)
         at android.os.Looper.loop(Looper.java:237)
         at android.app.ActivityThread.main(ActivityThread.java:7814)
         at java.lang.reflect.Method.invoke(Native Method)
         at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068)
    

    I am using version 1.1.1.

    implemetation {
        implementation 'com.dinuscxj:circleprogressbar:1.1.1'
    }
    
    Reviewed by rolud at 2020-09-28 10:12
  • 5. style这个属性重复了

    /res/merged/debug/values/values.xml Error:(754) Attribute "style" already defined with incompatible format. Error:(575) Original attribute defined here. Error:(754) Attribute "style" already defined with incompatible format. Error:(575) Original attribute defined here.

    Reviewed by scrylove at 2018-06-22 09:32
  • 6. 编译报错

    • What went wrong: Execution failed for task ':aquarobotman:mergeDebugResources'.

    java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed Output: D:\beifen0906\05281629-2.7-to3.0-master-beifen\proj.android\aquarobotman\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1108: error: duplicate value for resource 'attr/style' with config ''. D:\beifen0906\05281629-2.7-to3.0-master-beifen\proj.android\aquarobotman\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1108: error: resource previously defined here.

    Reviewed by azxcffdgadf at 2019-07-01 12:39
  • 7. setProgressStrokeWidth(float progressStrokeWidth)方法无效,是不是遗漏了设置给两个画笔?

    修改如下:

        public void setProgressStrokeWidth(float progressStrokeWidth) {
            mProgressStrokeWidth = progressStrokeWidth;
    		
    	/**将重新设置的Stroke Width值设置给画笔*/
            mProgressPaint.setStrokeWidth(mProgressStrokeWidth);
            mProgressBackgroundPaint.setStrokeWidth(mProgressStrokeWidth);
    
            ...
        }
    
    Reviewed by quibbler01 at 2022-07-29 08:03
  • 8. 发现一个bug,Shader设置为RADIAL的时候,如果ProgressStartColor和ProgressEndColor设置的不一样,内部创建RadialGradient会异常

    首先,内部的mRadius默认为0,且没有提供setter方法。

    当然Demo中没有设置ProgressStartColor和ProgressEndColor,默认是一样的。

    虽然在xml里面设置了app:progress_shader="radial"属性,但是不会触发异常,因为在updateProgressShader()方法中判断了,ProgressStartColor和ProgressEndColor一样的话是不会设置Shader,从而不会触发bug。

    如果ProgressStartColor和ProgressEndColor设置的不一样,内部创建RadialGradient会异常java.lang.IllegalArgumentException: ending radius must be > 0

    Reviewed by quibbler01 at 2022-07-26 09:50
  • 9. 45 to 0 instead of 100 to 0

    In previous versions i had this and an timer that would go from 45 seconds (full bar) to 0 (empty bar) with no problem,

    <com.dinuscxj.progressbar.CircleProgressBar
                    android:id="@+id/progress_token"
                    android:layout_width="32dp"
                    android:layout_height="32dp"
                    android:layout_marginBottom="@dimen/spacing_large"
                    android:layout_marginTop="@dimen/spacing_mlarge"
                    android:max="45"
                    app:line_count="45"
                    app:line_width="4dp"
                    app:progress_background_color="@color/progress_bg"
                    app:progress_end_color="@color/progress_green"
                    app:progress_start_color="@color/progress_green"
                    app:progress_stroke_cap="round"
                    app:progress_stroke_width="4dp"
                    app:progress_text_color="@android:color/transparent"
                    app:style="solid_line" />
    

    in current version this is not possible from the xml, i had to do this from the code:

    int progress = (100 * seconds) / 45;
    progress_token.setProgress(progress);
    
    Reviewed by RonEskinder at 2020-09-18 15:51
  • 10. Background color

    Hi, I'm unable to set the background color of the component, I've tried using app:background_color as suggested in the documentation but it gives me a compilation error: error: attribute background_color (aka com.augury.apusnodeconfiguration.staging:background_color) not found.

    Reviewed by sblepa at 2020-09-15 11:38
Arc pointer - simple customized progress bar in the form of an arch
Arc pointer - simple customized progress bar in the form of an arch

ArcPointer Simple customized progress bar in the form of an arch Demo Quick start Step 1 Gradle: compile 'io.github.dvegasa:arcpointer:1.0.2' Maven:

Jul 8, 2022
Holo Circular ProgressBar
Holo Circular ProgressBar

HoloCircularProgressBar What is HoloCircularProgressBar HoloCircularProgressBar is a Custom View implementation for Android you might know from the An

Jul 27, 2022
An android library to easily add circular progress bar into your Jetpack Compose apps.
An android library to easily add circular progress bar into your Jetpack Compose apps.

CircularProgressBar for Jetpack Compose An android library to easily add circular progress bar into your Jetpack Compose apps. Have a Look Usage Circu

Aug 10, 2022
Progress Button is a android library for hanling different types state like active, finished, enabled, disabled and reset with a single line of code.
Progress Button is a android library for hanling different types state like active, finished, enabled, disabled and reset with a single line of code.

Progress Button is a android library for hanling different types state like active, finished, enabled, disabled and reset with a single line of code.

Aug 11, 2022
A lightweight circular indicator view library for Android
A lightweight circular indicator view library for Android

A lightweight circular indicator view library for Android

Aug 1, 2022
Android loading or progress dialog widget library, provide efficient way to implement iOS like loading dialog and progress wheel
Android loading or progress dialog widget library, provide efficient way to implement iOS like loading dialog and progress wheel

ACProgressLite English Version / 中文版本 An Android loading widget library. Lite and easy to use, strong customizability. Can be used to implement 'iOS'

Jul 1, 2022
:barber: [Android Library] Stacked dual progress indicator progress-bar
:barber: [Android Library] Stacked dual progress indicator progress-bar

StackedHorizontalProgressBar Specs Featured in Show some ❤️ Android library with ability to show two progress indicators in one horizontal progress ba

May 14, 2022
A simple progress loader inspired by Can you Code this UI? Volume 6! - https://stories.uplabs.com/can-you-code-this-ui-volume-6-7bd09fa6dd92#.nyh2zhpvb

SlidingSquaresLoader Sliding Square Loader - A simple progress loader inspired by Can you Code this UI? Volume 6! Gradle Step 1. Add the JitPack repos

Jul 26, 2022
A wave view of android,can be used as progress bar.
A wave view of android,can be used as progress bar.

WaveView ![Gitter](https://badges.gitter.im/Join Chat.svg) A wave view of android,can be used as progress bar. Screenshot APK demo.apk What can be use

Aug 12, 2022
Simple Progress View that you can compare things, like statistics of a Football match
Simple Progress View that you can compare things, like statistics of a Football match

Simple Progress View that you can compare things, like statistics of a Football match

Jun 8, 2022
IOSProgressBar is a progress-bar lib for android. And the progress-bar looks like iOS system style
IOSProgressBar is a progress-bar lib for android. And the progress-bar looks like iOS system style

IOSProgressBar is a progress-bar lib for android. And the progress-bar looks like iOS system style

Jul 17, 2022
A progress wheel for android, intended for use instead of the standard progress bar.
A progress wheel for android, intended for use instead of the standard progress bar.

Deprecation warning This project is no-longer maintained, and has not been maintained for a few years now. If you're looking for an alternative librar

Jul 30, 2022
MaterialLoadingProgressBar provide a styled ProgressBar which looks like SwipeRefreshLayout's loading indicator(support-v4 v21+)
MaterialLoadingProgressBar   provide a styled ProgressBar which looks  like SwipeRefreshLayout's loading indicator(support-v4  v21+)

MaterialLoadingProgressBar MaterialLoadingProgressBar provide a styled ProgressBar which looks like SwipeRefreshLayout's loading indicator(support-v4

Aug 7, 2022
A simple library for creating circular progressbars for Android

CircleProgressBar A simple library for creating circular progressbars for Android. Examples Installation Get it via gradle: implementation 'com.emreda

Apr 11, 2022
Loading layout is a container view that manages easy switching between loading, completed and other states of your screen with a single line.
Loading layout is a container view that manages easy switching between loading, completed and other states of your screen with a single line.

Loading layout is a container view that manages easy switching between loading, completed and other states of your screen with a single line.

Jul 5, 2022
DownloadProgressBar is an android library that delivers awesome custom progress bar. You can manipulate it's state in every way.
DownloadProgressBar is an android library that delivers awesome custom progress bar. You can manipulate it's state in every way.

Download Progress Bar Android progress bar with cool animation, inspired by : https://dribbble.com/shots/2012292-Download-Animation ###Attributes Attr

Jun 28, 2022
Now deprecated. A small Android library allowing you to have a smooth and customizable horizontal indeterminate ProgressBar
Now deprecated. A small Android library allowing you to have a smooth and customizable horizontal indeterminate ProgressBar

Description Small library allowing you to make a smooth indeterminate progress bar. You can either user your progress bars and set this drawable or us

Aug 11, 2022
Android library to realize the various states and transitions in a ProgressBar.
Android library to realize the various states and transitions in a ProgressBar.

StateProgressBar StateProgressBar is an Android library to realize the various states and transitions in a ProgressBar. Quick Start Get a feel of how

Aug 12, 2022
An android library to display a progressbar that goes around an image.
An android library to display a progressbar that goes around an image.

android-square-progressbar First things first This library is setup to work with the Android Studio and Gradle. If you're using the Eclipse environmen

Jul 23, 2022