CountDownTimer倒计时
来源:互联网 发布:ug复杂模具编程思路 编辑:程序博客网 时间:2024/05/23 01:53
直接上代码public class MainActivity extends Activity { private TextView text; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); text = ((TextView) findViewById(R.id.text)); timer.start(); } private CountDownTimer timer=new CountDownTimer(6000,1000) { @Override public void onTick(long l) { text.setText((l/1000)+"秒后可重发"); } @Override public void onFinish() { text.setText("获取验证码"); } };}xml文件<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"> <TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" /></RelativeLayout>
0 0
- CountDownTimer倒计时
- CountDownTimer倒计时
- CountDownTimer倒计时
- CountDownTimer 倒计时
- CountDownTimer倒计时
- 倒计时CountDownTimer
- CountDownTimer,倒计时
- CountDownTimer 倒计时
- CountDownTimer 倒计时
- CountdownTimer倒计时
- CountDownTimer倒计时
- 倒计时的CountDownTimer
- 倒计时的CountDownTimer
- android 定时器 CountDownTimer 倒计时
- android倒计时类CountDownTimer
- 使用CountdownTimer进行倒计时
- 倒计时的CountDownTimer
- Android倒计时CountDownTimer小记
- apk反编译出错:Exception in thread "main" brut.androlib.AndrolibException: Could not decode ars c file
- pkg-config的用法
- 异常(exception)
- MongoDB数据丢失(即无法写入)的原因
- JS类似Java String.format的函数
- CountDownTimer倒计时
- Linux源码安装的文件默认的存放路径
- MOVE和CTAS比较
- ios界面之间传递数据
- 位运算 8皇后学习笔记
- 非阻塞同步算法与CAS(Compare and Swap)无锁算法
- Java容器类
- Qt5多线程
- 从实战项目学习Android(二)Textview的一行显示、背景拉伸