直接上代码把

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,
某东14薪变16薪,是诚意还是套路?os模块的简单使用浏览器内核(理解)让人意想不到的Python之樱花树(turtle库的华丽样式)java四大函数式接口(重点,简单)html写樱花树,写樱花树的作文计算机网络---计算机网络基本概念(协议、体系)HashMap详解