inj*_*eer 10
你应该用CountDownTimer它:
timer = new CountDownTimer( 3000, 1000 ) {
@Override public void onTick( long millisUntilFinished ) {
button.setText( "count down " + millisUntilFinished );
}
@Override public void onFinish() {
button.setOnClickListener( onClickListener );
}
};
Run Code Online (Sandbox Code Playgroud)
在某处下面:
timer.start()
Run Code Online (Sandbox Code Playgroud)
button.setEnabled(false);
new CountDownTimer(3000, 1000) {
public void onTick(long millisUntilFinished) {
button.setText("Wait for " + (millisUntilFinished / 1000) + " seconds");
}
public void onFinish() {
button.setEnabled(true);
button.setText("Press me!");
}
}.start();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1075 次 |
| 最近记录: |