CountDownTimerSupport - 更簡單易用的Android倒計時器

轉載請註明出處:
http://blog.csdn.net/aa464971/article/details/72768063

Github地址:
https://github.com/xiandanin/CountDownTimerSupport

Android倒計時器,支持開始倒計時、暫停倒計時、繼續倒計時、停止倒計時、重新倒計時

示例apk

效果演示

快速開始

Android Studio - 在build.gradle中引入

compile 'com.dyhdyh.support:count-down-timer:1.0.2'

初始化

//總時長 間隔時間
CountDownTimerSupport mTimer = new CountDownTimerSupport(millisInFuture, countDownInterval);
mTimer.setOnCountDownTimerListener(new OnCountDownTimerListener() {
            @Override
            public void onTick(long millisUntilFinished) {
                //間隔回調
            }

            @Override
            public void onFinish() {
                //計時器停止
            }
        });

啓動倒計時

mTimer.start();

暫停倒計時

mTimer.pause();

恢復倒計時

mTimer.resume();

停止倒計時

mTimer.stop();

重置並啓動倒計時

mTimer.reset();
mTimer.start();
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章