闪屏页

来源:互联网 发布:windows平板哪个好 编辑:程序博客网 时间:2024/06/05 15:22
//获取布局文件LinearLayout rlRoot =(LinearLayout)findViewById(R.id.rl_root);//实例化RotateAnimationRotateAnimation animRotate = new RotateAnimation(0,360,Animation.RELATIVE_TO_SELF,o.5f,Animation.RELATIVE_TO_SELF,0.5);//动画旋转animRotate .setDuration(1000);//动画时间animRotate .setFillAfter(ture);//保持动画结束状态//动画缩放ScaleAnimation animScale = new ScaleAnimation(0,1,0,1,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);animaScale.setDuration(1000);animaScale.setFillAfter(ture);//动画渐变AlphaAnimation animaAlpha = new AlphaAnimation(0,1);animaAlpha.setDuration(1000);animaAlpha.setFillAfter(ture);//动画集合AnimationSet set = new AnimationSet(true);set.addAnimation(animaRotate);set.addAnimation(animScale );set.addAnimation(animaAlpha);//启动动画rlRoot.startAnimation(set);set.setAnimationListener(new AnimationListener(){public void onAnimationStart(Animation animation) {}public void onAnimationRepeat(Animation animation) {// TODO Auto-generated method stub}public void onAnimationEnd(Animation animation) {//动画结束,跳转页面//如果是第一次进入,跳新手引导//否则跳转主页面boolean isFirstEnter = prefutils.getBoolean(SplashActivity.this, "is_first_enter", true);Intent intent;if(isFirstEnter ){intent = new Intent(getApplicationContext(),GuideActivity.class);}else{intent  = new Intent(getApplicationContext(),MainActivity.class);}startActivity(intent);finish();}});

0 0