開源地址爲https://github.com/daimajia/NumberProgressBar
android studio 添加
compile 'com.daimajia.numberprogressbar:library:1.2@aar'
就可以。
使用也非常的簡單 代碼如下
<com.daimajia.numberprogressbar.NumberProgressBar android:id="@+id/number_progress_bar" android:layout_width="wrap_content" android:layout_height="wrap_content" />進度條的顏色有很多種,由style屬性控制:
<com.daimajia.numberprogressbar.NumberProgressBar android:id="@+id/number_progress_bar" style="@style/NumberProgressBar_Default" />
style具體的種類有以下幾種:
NumberProgressBar_Default
NumberProgressBar_Passing_Green
NumberProgressBar_Relax_Blue
NumberProgressBar_Grace_Yellow
NumberProgressBar_Warning_Red
NumberProgressBar_Funny_Orange
NumberProgressBar_Beauty_Red
NumberProgressBar_Twinkle_Night
具體的效果大家可以自己更換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:progress_max="100" custom:progress_curent="80" />這樣關於NumberProgressBar的簡單介紹就完了。。。