Skip to content

圆形进度条:最简单的 Android 圆形进度条控件,支持自定义颜色、边框、背景等属性。

Notifications You must be signed in to change notification settings

Ccapton/CircleProgressBar

 
 

Repository files navigation

CircularProgressBar

Platform API

最简单的圆形进度条控件,支持自定义颜色、边框、背景等属性。

CircleProgressBar

使用方法

首先,你需要导入模块项目或者添加依赖类库:

build.gradle(Project)

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

build.gradle(Module:app)

	dependencies {
	        compile 'com.github.Ccapton:CircleProgressBar:1.1.0'
	}

样式文件

<online.osslab.CircleProgressBar
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    circle:background_color="#FFCDD2"
    circle:background_width="5dp"
    circle:progress_color="#F44336"
    circle:progress_width="10dp" />

当然,你还可以通过以下属性个性化圆形图像样式。

图形属性:
  • circle:max_value (integer) -> 150
  • circle:progress_value (integer) -> 0
  • circle:progressbar_color (color) -> BLACK
  • circle:background_color (color) -> GRAY
  • circle:progress_width (dimension) -> 7dp
  • circle:background_width (dimension) -> 3dp

代码构建

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

关于作者

许可协议

Copyright 2016 Lopez Mikhae

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.

About

圆形进度条:最简单的 Android 圆形进度条控件,支持自定义颜色、边框、背景等属性。

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%