【发布时间】:2015-11-24 15:15:36
【问题描述】:
在我的初始屏幕上,我想让 TextView 淡入,5 秒后淡出,在它淡出后我希望它打开一个新的 xml 文件。有人可以帮我吗?我对编码有点陌生,所以也许一些代码会很棒!亲切的问候!
【问题讨论】:
-
如果您不熟悉编码,搜索您自己进行的代码示例对您的帮助最大。尤其是当您可以比较不同的解决方案时。
标签: android animation textview startup
在我的初始屏幕上,我想让 TextView 淡入,5 秒后淡出,在它淡出后我希望它打开一个新的 xml 文件。有人可以帮我吗?我对编码有点陌生,所以也许一些代码会很棒!亲切的问候!
【问题讨论】:
标签: android animation textview startup
在 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();
【讨论】: