###Demo
dependencies{
compile 'com.daimajia.numberprogressbar:library:1.2@aar'
}
<dependency>
<groupId>com.daimajia.numberprogressbar</groupId>
<artifactId>library</artifactId>
<version>1.2</version>
<type>apklib</type>
</dependency>
Use it in your own code code:
<com.daimajia.numberprogressbar.NumberProgressBar
android:id="@+id/number_progress_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
I made some predesign style.U can use them via style
property.
Use the preset style just like below:
<com.daimajia.numberprogressbar.NumberProgressBar
android:id="@+id/number_progress_bar"
style="@style/NumberProgressBar_Default"
/>
In the above picture,the style is:
NumberProgressBar_Default
NumberProgressBar_Passing_Green
NumberProgressBar_Relax_Blue
NumberProgressBar_Grace_Yellow
NumberProgressBar_Warning_Red
NumberProgressBar_Funny_Orange
NumberProgressBar_Beauty_Red
NumberProgressBar_Twinkle_Night
U can get some more beautiful color from kuler
###Bulid
run gradlew.bat assembleDebug
(Win)
or
run ./gradlew assembleDebug
(Mac/Linux)
###Attributes
There are several attributes u can set:
The readched area and unreached area:
- color
- height
The text area:
- color
- text size
- visibility
- distance between reached area and unreached area
The bar:
- max progress
- current progress
for example, the default style:
<com.daimajia.numberprogressbar.NumberProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
custom:progress_unreached_color="#CCCCCC"
custom:progress_reached_color="#3498DB"
custom:progress_unreached_bar_height="0.75dp"
custom:progress_reached_bar_height="1.5dp"
custom:progress_text_size="10sp"
custom:progress_text_color="#3498DB"
custom:progress_text_offset="1dp"
custom:progress_text_visibility="visible"
custom:max="100"
custom:progress="80"
/>