Android 应用启动动画代码

时间:2014-05-04 18:46:30   收藏:0   阅读:597
requestWindowFeature(Window.FEATURE_NO_TITLE);//设置无标题
setContentView(R.layout.activity_main);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);//设置全屏
ImageView welcomeImg = (ImageView) findViewById(R.id.iv);//启动时显示的图片
AlphaAnimation anima = new AlphaAnimation(0.3f, 1.0f);//创建一个透明度从0.3 慢慢到不透明的原图的动画效果
anima.setDuration(3000);// 设置动画显示时间
welcomeImg.startAnimation(anima);//设置启动时图片的动画
anima.setAnimationListener(new AnimationImpl());//设置动画监听
 private class AnimationImpl implements AnimationListener {//动画监听

  @Override   public void onAnimationStart(Animation animation) { //   welcomeImg.setBackgroundResource(R.drawable.ic_launcher);   }

  @Override   public void onAnimationEnd(Animation animation) {    Intent intent = new Intent(MainActivity.this, OtherActivity.class);

   startActivity(intent);    finish();   }

  @Override   public void onAnimationRepeat(Animation animation) {

  }  }

 


 

Android 应用启动动画代码,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!