|
| 1 | + |
| 2 | +## CircleProgressBar |
| 3 | +[中文版文档](https://github.com/dinuscxj/CircleProgressBar/blob/master/README-ZH.md) |
| 4 | + |
| 5 | +The [CircleProgressBar](https://github.com/dinuscxj/CircleProgressBar) extends ProgressBar, It has both solid and line two styles. Besides, progress value can be freely customized. |
| 6 | +If you are interested in cool loading animations, you can see [LoadingDrawable](https://github.com/dinuscxj/LoadingDrawable). |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | +### Usage |
| 11 | + |
| 12 | +#### Gradle |
| 13 | + ```gradle |
| 14 | + dependencies { |
| 15 | + compile 'com.dinuscxj:circleprogressbar:1.1.1' |
| 16 | + } |
| 17 | + ``` |
| 18 | + |
| 19 | +#### Used in xml: |
| 20 | + |
| 21 | +```java |
| 22 | +<com.dinuscxj.progressbar.CircleProgressBar |
| 23 | + android:id="@+id/line_progress" |
| 24 | + android:layout_marginTop="@dimen/default_margin" |
| 25 | + android:layout_width="50dp" |
| 26 | + android:layout_height="50dp" /> |
| 27 | +``` |
| 28 | + |
| 29 | +### Attributes |
| 30 | +There are several attributes you can set: |
| 31 | + |
| 32 | +The **style**: |
| 33 | + |
| 34 | +* line (default) |
| 35 | +* solid_line |
| 36 | +* solid |
| 37 | + |
| 38 | +The **background color** |
| 39 | + |
| 40 | +* background_color |
| 41 | + |
| 42 | +The **progress text**: |
| 43 | + |
| 44 | +* text color |
| 45 | +* text size |
| 46 | +* visibility |
| 47 | +* format |
| 48 | + |
| 49 | +The **progress circle**: |
| 50 | + |
| 51 | +* width |
| 52 | +* start_color |
| 53 | +* end_color |
| 54 | +* background color |
| 55 | + |
| 56 | +The **progress_shader** |
| 57 | + |
| 58 | +* linear (default,but if start_color and end_color equivalence, will not set the shader) |
| 59 | +* radial |
| 60 | +* sweep |
| 61 | + |
| 62 | +The **progress_stroke_cap** |
| 63 | + |
| 64 | +* butt (default) |
| 65 | +* round |
| 66 | +* square |
| 67 | + |
| 68 | +The **line style**: |
| 69 | + |
| 70 | +* width |
| 71 | +* count |
| 72 | + |
| 73 | +for example : |
| 74 | +```java |
| 75 | +<com.dinuscxj.progressbar.CircleProgressBar |
| 76 | + android:layout_width="50dp" |
| 77 | + android:layout_height="50dp" |
| 78 | + |
| 79 | + app:style="line" |
| 80 | + |
| 81 | + app:background_color="@color/holo_red_light" |
| 82 | + |
| 83 | + app:progress_text_color="@color/holo_purple" |
| 84 | + app:progress_text_size="@dimen/progress_text_size" |
| 85 | + app:draw_progress_text="true" |
| 86 | + app:progress_text_format_pattern="@string/progress_text_format_pattern" |
| 87 | + |
| 88 | + app:progress_stroke_width="1dp" |
| 89 | + app:progress_start_color="@color/holo_purple" |
| 90 | + app:progress_end_color="@color/holo_green_light" |
| 91 | + app:progress_background_color="@color/holo_darker_gray" |
| 92 | + |
| 93 | + app:progress_shader="sweep" |
| 94 | + |
| 95 | + app:progress_stroke_cap="round" |
| 96 | + |
| 97 | + app:line_width="4dp" |
| 98 | + app:line_count="30"/> |
| 99 | +``` |
| 100 | +### Advantages |
| 101 | +1. extends ProgressBar, do not care to save the current state of progress, ProgressBar has written in to help us in onSaveInstanceState () and onRestoreInstanceState (Parcelable state). |
| 102 | +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 |
| 103 | +3. Code elegant, very comprehensive code comments, neat format, you can set the relevant properties directly in xml. |
| 104 | + |
| 105 | +### About me |
| 106 | +I like Android, like open source, and like doing something interesting. :) |
| 107 | +If you like CircleProgressBar or use it, you can star this repo and send me some feedback. Thanks! ~_~ |
| 108 | + ***QQ Group:*** **342748245** |
| 109 | + |
| 110 | +### License |
| 111 | + Copyright 2015-2019 dinuscxj |
| 112 | + |
| 113 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 114 | + you may not use this file except in compliance with the License. |
| 115 | + You may obtain a copy of the License at |
| 116 | + |
| 117 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 118 | + |
| 119 | + Unless required by applicable law or agreed to in writing, software |
| 120 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 121 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 122 | + See the License for the specific language governing permissions and |
| 123 | + limitations under the License. |
0 commit comments