Splash闪屏页-三种动画效果

三种动画效果

旋转 RotateAnimation

缩放 ScaleAnimation

渐变 AlphaAnimation

 

动画效果集合 

AnimationSet

 

 1 // 初始化欢迎页面的动画
 2 
 3 private void initViews(){
 4 
 5       RelativeLayout rlRoot = (RelativeLayout) findViewById(R.id.rl_root);    
 6 
 7       RotateAnimation rotate  = new RotateAnimation(0,360,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
 8       rotate.setDuration(1000);//动画执行的时间
 9       rotate.setFillAfter(true);//动画结束后保持最终状态
10 
11       ScaleAnimation scale = new ScaleAnimation(0,1,0,1,,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
12       scale.setDuration(1000);
13       scale.setFillAfter(true);
14 
15       AlphaAnimation alpha = new AlphaAnimation(0,1);
16       alpha.setDuration(1000);
17       alpha.setFillAfter(true);
18 
19       AnimationSet set = new AnimationSet(false);
20       set.addAnimation(rotate);
21       set.addAnimation(scale);
22       set.addAnimation(alpha);
23       
24       rlRoot.startAnimation(set);   
25         
26 }                          

 

posted @ 2015-10-05 10:44  lude313  阅读(419)  评论(1编辑  收藏  举报