import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Window;
import android.view.animation.AlphaAnimation;
import android.view.animation.AnimationSet;
import android.widget.ImageView;
public class WelcomeActivity extends Activity {
private final int SPLASH_DISPLAY_LENGHT = 3000; //延迟三秒
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 去除title
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.welcome);
ImageView image=(ImageView)findViewById(R.id.image);
AnimationSet animationset=new AnimationSet(true);
AlphaAnimation alphaAnimation=new AlphaAnimation(1, 0);
alphaAnimation.setDuration(5500);
animationset.addAnimation(alphaAnimation);
image.startAnimation(animationset);
new Handler().postDelayed(new Runnable(){
@Override
public void run() {
//MainActivity是欢迎界面显示之后要跳转的界面
Intent mainIntent = new Intent(WelcomeActivity.this,MainActivity.class);
WelcomeActivity.this.startActivity(mainIntent);
WelcomeActivity.this.finish();
}
}, SPLASH_DISPLAY_LENGHT);
}
}