启动动画
Animation on startup
在我的闪屏上,我想让一个 TextView 淡入,5 秒后淡出,在它淡出后我想让它打开一个新的 xml 文件。有人可以帮我吗?我对编码有点陌生,所以也许一些代码会很棒!亲切的问候!
在 oncreate() 中试试这个:
//First start animation for fadein
Animation animation = AnimationUtils.loadAnimation(this,R.anim.abc_fade_in);
yourtextView.startAnimation(animation);
// The thread to wait for 5 seconds
mSplashThread = new Thread(){
@Override
public void run(){
try {
Thread.sleep(5000);
}
catch(InterruptedException ex){
} finally{
//start animation for fadeout after 5 seconds
Animation animation = AnimationUtils.loadAnimation(YourClass.this,R.anim.abc_fade_out);
yourtextView.startAnimation(animation);
//Start next activity
Intent intent = new Intent(YourClass.this,MainActivity.class);
startActivity(intent);
}
}
};
mSplashThread.start();
在我的闪屏上,我想让一个 TextView 淡入,5 秒后淡出,在它淡出后我想让它打开一个新的 xml 文件。有人可以帮我吗?我对编码有点陌生,所以也许一些代码会很棒!亲切的问候!
在 oncreate() 中试试这个:
//First start animation for fadein
Animation animation = AnimationUtils.loadAnimation(this,R.anim.abc_fade_in);
yourtextView.startAnimation(animation);
// The thread to wait for 5 seconds
mSplashThread = new Thread(){
@Override
public void run(){
try {
Thread.sleep(5000);
}
catch(InterruptedException ex){
} finally{
//start animation for fadeout after 5 seconds
Animation animation = AnimationUtils.loadAnimation(YourClass.this,R.anim.abc_fade_out);
yourtextView.startAnimation(animation);
//Start next activity
Intent intent = new Intent(YourClass.this,MainActivity.class);
startActivity(intent);
}
}
};
mSplashThread.start();