Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dinuscxj/CircleProgressBar
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.
https://github.com/dinuscxj/CircleProgressBar
Last synced: 3 months ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/dinuscxj/CircleProgressBar
- Owner: dinuscxj
- Created: 2016-06-11T02:03:54.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-04-11T10:03:09.000Z (over 3 years ago)
- Last Synced: 2024-05-22T22:37:36.269Z (6 months ago)
- Language: Java
- Homepage:
- Size: 14.4 MB
- Stars: 1,258
- Watchers: 40
- Forks: 218
- Open Issues: 12
-
Metadata Files:
- Readme: README-ZH.md
Awesome Lists containing this project
- awesome-loading-indicators - CircleProgressBar - 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. (Java)
README
## CircleProgressBar
[CircleProgressBar](https://github.com/dinuscxj/CircleProgressBar)继承View, 是包含实心和线条两种风格的圆环进度条. 此外, 进度值可以随意定制.
如果你对酷炫的进度条比较感兴趣, 或许你更喜欢 [LoadingDrawable](https://github.com/dinuscxj/LoadingDrawable).![](https://raw.githubusercontent.com/dinuscxj/CircleProgressBar/master/Preview/CircleProgressBar.gif?width=300)
### 用法
#### Gradle
```gradle
dependencies {
compile 'com.dinuscxj:circleprogressbar:1.3.6'
}
```#### 用在xml中:
```xml
```
### 属性
有下面这些属性你可以设置:The **style**:
* line (默认)
* solid_line
* solidThe **background color**
* background_color
The **progress text**:
* text color
* text size
* visibility
* formatThe **progress circle**:
* width
* start degree
* start color
* end color
* background color
* draw background outside progressThe **progress_shader**
* linear (默认,如果start_color和end_color相同则不会设置shader)
* radial
* sweepThe **progress blur** (模糊半径(blur_radius)必须大于0)
* normal (默认)
* solid
* outer
* innerThe **progress stroke cap**
* butt (默认)
* round
* squareThe **line style**:
* width
* count例如 :
```xml```
格式化 progress
``` java
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));
}
}
// 设置你想要的ProgressFormatter
CircleProgressBar.setProgressFormatter(new MyProgressFromatter);
// 隐藏进度的显示
CircleProgressBar.setProgressFormatter(null);
```
### 优点
1. 继承View, 不必关心当前进度状态的保存, CircleProgressBar 已经在onSaveInstanceState()和 onRestoreInstanceState(Parcelable state)中写好了。
2. 定制性很强,可以设置两种风格的进度条,设置进度条的颜色和进度文本的颜色和大小, 由于代码中对于进度文本的格化化是使用的String.format(), 所以进度文本可以根据需要随意定制
3. 代码优雅,代码注释很全面,格式整齐,可以直接在xml中设置相关的属性。### 关于我
本人喜欢android、开源而且比较喜欢做一些有意思的东西 :)
如果你喜欢CircleProgressBar或者正在使用它,欢迎star这个项目, 并且希望反馈给我一些建议. 谢谢! ~_~
***QQ 群:*** **342748245**### License
Copyright 2015-2019 dinuscxjLicensed 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 athttp://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.