Android 中的倒计时 CountDownTimer
来源:互联网 发布:甘肃网络电视台回播 编辑:程序博客网 时间:2024/05/21 14:43
在Android中系统提供了一个倒计时的类,CountDownTimer,使用也十分简单。可以简单的做一个倒计时的功能
import android.os.CountDownTimer;import android.widget.Button;/** * Created by YanJing on 2015/12/10/0010. */public class TimeCount extends CountDownTimer { private final Button button; public TimeCount(long millisInFuture, long countDownInterval, Button button) { super(millisInFuture, countDownInterval); this.button = button; } @Override public void onTick(long millisUntilFinished) { button.setClickable(false); button.setText("重新获取(" + millisUntilFinished / 1000 + ")"); } @Override public void onFinish() { button.setClickable(true); button.setText("重新获取"); }}
可以传入需要倒计时的时长,倒计单位,以及一个button
TimeCount timeCount = new TimeCount(60000, 1000,btnGetForgetCode); timeCount.start();
阅读全文
0 0
- Android 中的倒计时 CountDownTimer
- android 定时器 CountDownTimer 倒计时
- android倒计时类CountDownTimer
- Android倒计时CountDownTimer小记
- Android CountDownTimer 倒计时实现
- Android CountDownTimer 倒计时类
- android CountDownTimer 倒计时
- android 倒计时 CountDownTimer
- Android 倒计时CountDownTimer
- android倒计时,使用CountDownTimer
- android 倒计时 CountDownTimer
- Android 倒计时CountDownTimer
- Android CountDownTimer倒计时
- Android 倒计时CountDownTimer使用
- android之倒计时CountDownTimer
- Android倒计时CountDownTimer
- Android内置倒计时类CountDownTimer
- Android 使用CountDownTimer实现倒计时
- CentOS 7 安装Python3以及pip3
- java基础编程#1
- RecyclerView横向和竖向滑动冲突
- display:table,布局自动分宽度
- 2html基本介绍
- Android 中的倒计时 CountDownTimer
- SDN在云数据中心的应用——架构篇
- [BZOJ4919][Lydsy六月份月赛 .C][树上DP][启发式合并]大根堆
- 3html和css简单介绍
- 4css
- 【正一专栏】国乒球员退赛——体育总局说点人话就这么难吗?
- eclipse maven引入第三方jar包后如何下载源代码(sources)
- iOS编程学习二
- C++学习笔记,字符串输入