直接上代码把

public class SplashActivity extends AppCompatActivity { private TextView tv;
privateRunnable mRunnable; @Override protected void onCreate(Bundle
savedInstanceState) {super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash); tv = (TextView) findViewById(R.id.tv
); MyCountDownTimer myCountDownTimer =new MyCountDownTimer(5000,1000); // 5000代表
5秒后进入主页面 myCountDownTimer.start(); handler.postDelayed(mRunnable = new
Runnable() {@Override public void run() { Intent intent = new
Intent(SplashActivity.this,TwoActivity.class); startActivity(intent); finish();
} },5000); tv.setOnClickListener(new View.OnClickListener() { @Override public
voidonClick(View v) { Intent intent = new Intent(SplashActivity.this
,TwoActivity.class); startActivity(intent); finish(); if(mRunnable!=null){ //
判断消息handler消息如果消息不是空就把handler消息remove 清除掉 这样防止点过 跳过 之后还会出现在次开启一个Activity handler
.removeCallbacks(mRunnable); } } }); } private Handler handler = new Handler();
classMyCountDownTimer extends CountDownTimer{ public MyCountDownTimer(long
millisInFuture,long countDownInterval){ super
(millisInFuture,countDownInterval); }@Override public void onTick(long
millisUntilFinished) {tv.setText("跳过("+millisUntilFinished /1000+")"); }
@Override public void onFinish() { tv.setText("正在跳转"); } } 效果图

技术
©2019-2020 Toolsou All rights reserved,
java几种常见运行时异常及简单例子PHP打印输出log作弊器开发商致歉【Python-数据读取】读取txt文件每一行数据生成列表latex中自定义的命令———\newcommandpython读取、写入txt文本内容明明是post请求为什么会在地址栏显示参数?(精华)2020年8月2日 TypeScript 泛型的使用(精华)2020年7月15日 微信小程序 import和include差别Vue 中获取下拉框的文本及选项值