短信倒计时自定义按钮
来源:互联网 发布:python中文注释 编辑:程序博客网 时间:2024/06/03 19:11
Timer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* Description:自定义Timer
* <p>
* Created by Mjj on 2016/12/4.
*/
public
class
TimeCount
extends
CountDownTimer {
private
Button button;
//参数依次为总时长,和计时的时间间隔
public
TimeCount(Button button,
long
millisInFuture,
long
countDownInterval) {
super
(millisInFuture, countDownInterval);
this
.button = button;
}
//计时过程显示
@Override
public
void
onTick(
long
millisUntilFinished) {
String time =
"("
+ millisUntilFinished /
1000
+
")秒"
;
setButtonInfo(time,
"#c1c1c1"
,
false
);
}
//计时完毕时触发
@Override
public
void
onFinish() {
setButtonInfo(
"重新获取"
,
"#f95353"
,
true
);
}
/**
* 验证按钮在点击前后相关设置
*
* @param content 要显示的内容
* @param color 颜色值
* @param isClick 是否可点击
*/
private
void
setButtonInfo(String content, String color,
boolean
isClick) {
button.setText(content);
button.setBackgroundColor(Color.parseColor(color));
button.setClickable(isClick);
}
}
说明:根据自己的需求,在这里修改背景颜色和不同状态显示文字即可,在需要监听的按钮下直接调用new TimerCount(xxx,xxx,xxx).start()即可。
0 0
- 短信倒计时自定义按钮
- 自定义倒计时按钮
- 自定义倒计时跳过按钮
- 短信按钮 自定义控件
- 获取短信按钮倒计时60秒
- 模拟 短信验证码 按钮倒计时
- 短信验证码按钮60秒倒计时
- 获取短信按钮倒计时60秒
- 简单的自定义倒计时按钮
- 自定义倒计时按钮swift版
- Android快速自定义倒计时按钮
- react-native 自定义倒计时按钮
- Android自定义一个倒计时按钮
- 发送短信验证后,按钮倒计时,防止刷新倒计时失效
- Android自定义控件之自定义倒计时按钮
- 自定义短信验证码中的倒计时控件
- 短信发送倒计时按钮封装,退出再进入可继续倒计时,绝对时间倒计时
- 具有倒计时功能的自定义按钮
- 关于平方根倒数速算法(雷神之锤3,牛B)
- Unity全景图
- 推荐算法---基于用户的协同过滤算法
- Android Studio多渠道打包
- DZNEmptyDataSet在iOS7时重新加载按钮点击无效
- 短信倒计时自定义按钮
- LeetCode111:Minimum Depth of Binary Tree
- base64计算方法
- 梳理一下重新拿到一个编辑器该做些什么
- HTTP接口跨域-服务端接受返回处理
- 如何查看电脑核数和线程数(网传方法有误)
- 高可用架构-- MySQL主从复制的配置
- Sicily AVL Tree
- JDBC存图片与取出图片