1.daimajia的 https://github.com/daimajia/NumberProgressBar
compile 'com.daimajia.numberprogressbar:library:1.4@aar'
MainAc
private int i = 1;
private NumberProgressBar numberbar1;
private NumberProgressBar numberbar2;
private NumberProgressBar numberbar3;
private NumberProgressBar numberbar4;
private NumberProgressBar numberbar5;
private NumberProgressBar numberbar6;
private NumberProgressBar numberbar7;
private NumberProgressBar numberbar8;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initView();
new CountDownTimer(50000, 500) {
@Override
public void onTick(long millisUntilFinished) {
i++;
numberbar1.setProgress(i);
}
@Override
public void onFinish() {
}
}.start();
}
private void initView() {
numberbar1 = (NumberProgressBar) findViewById(R.id.numberbar1);
numberbar2 = (NumberProgressBar) findViewById(R.id.numberbar2);
numberbar3 = (NumberProgressBar) findViewById(R.id.numberbar3);
numberbar4 = (NumberProgressBar) findViewById(R.id.numberbar4);
numberbar5 = (NumberProgressBar) findViewById(R.id.numberbar5);
numberbar6 = (NumberProgressBar) findViewById(R.id.numberbar6);
numberbar7 = (NumberProgressBar) findViewById(R.id.numberbar7);
numberbar8 = (NumberProgressBar) findViewById(R.id.numberbar8);
}
MainXml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.as.progressbar.MainActivity">
<com.daimajia.numberprogressbar.NumberProgressBar
android:id="@+id/numberbar1"
android:layout_width="wrap_content"
android:padding="20dp"
custom:progress_max="100"
custom:progress_current="0"
style="@style/NumberProgressBar_Default"
android:layout_height="wrap_content" />
<com.daimajia.numberprogressbar.NumberProgressBar
android:id="@+id/numberbar2"
android:layout_height="wrap_content"
android:padding="20dp"
custom:progress_current="20"
android:layout_width="match_parent"
style="@style/NumberProgressBar_Passing_Green"
/>
<com.daimajia.numberprogressbar.NumberProgressBar
android:id="@+id/numberbar3"
android:layout_margin="20dp"
style="@style/NumberProgressBar_Relax_Blue"
custom:progress_current="30"
android:layout_height="wrap_content" />
<com.daimajia.numberprogressbar.NumberProgressBar
android:id="@+id/numberbar4"
android:layout_width="wrap_content"
android:layout_margin="20dp"
style="@style/NumberProgressBar_Grace_Yellow"
custom:progress_current="40"
android:layout_height="wrap_content" />
<com.daimajia.numberprogressbar.NumberProgressBar
android:id="@+id/numberbar5"
android:layout_width="wrap_content"
android:layout_margin="20dp"
custom:progress_current="50"
style="@style/NumberProgressBar_Warning_Red"
android:layout_height="wrap_content" />
<com.daimajia.numberprogressbar.NumberProgressBar
android:id="@+id/numberbar6"
android:layout_width="wrap_content"
android:layout_margin="20dp"
style="@style/NumberProgressBar_Funny_Orange"
custom:progress_current="60"
android:layout_height="wrap_content" />
<com.daimajia.numberprogressbar.NumberProgressBar
android:id="@+id/numberbar7"
android:layout_width="wrap_content"
android:layout_margin="20dp"
style="@style/NumberProgressBar_Beauty_Red"
custom:progress_current="70"
android:layout_height="wrap_content" />
<com.daimajia.numberprogressbar.NumberProgressBar
android:id="@+id/numberbar8"
android:layout_width="wrap_content"
android:layout_margin="20dp"
style="@style/NumberProgressBar_Twinkle_Night"
custom:progress_current="80"
android:layout_height="wrap_content" />
</LinearLayout>