android中不做任何动作几秒后自动跳到另一个

请详细点,谢谢哈,急求……
2024-11-25 21:33:36
推荐回答(3个)
回答1:

用个线程睡眠一下就行了,下边是源码,你自己看看吧!
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE); //去掉标题栏
setContentView(R.layout.activity_the2); // 绑定布局文件
thread=new Thread(this);
thread.start();
//获取组件
}
@Override
public void run() {
try {
Thread.sleep(3000);
Intent intent = new Intent(DengluActivity.this, FirstActivity.class);

// 跳转界面
startActivity(intent);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

回答2:

ll = (LinearLayout)this.findViewById(R.id.loading);

Animation animation = new AlphaAnimation(0.5f, 1.0f);
animation.setDuration(1000);
animation.setAnimationListener(new AnimationListener() {

@Override
public void onAnimationStart(Animation animation) {
}

@Override
public void onAnimationRepeat(Animation animation) {
}

@Override
public void onAnimationEnd(Animation animation) {

Intent intent = new Intent(LoadingActivity.this,
WelcomeActivity.class);

startActivity(intent);

}
});
ll.setAnimation(animation);

利用动画实现,也可以用线程实现。sleep一下

回答3:

给你个demo看看吧,你说的应该是应用启动动画。