码迷,mamicode.com
首页 > 移动开发 > 详细

Android开发之动画整理

时间:2016-06-18 22:23:59      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:

rlRoot = (RelativeLayout) findViewById(R.id.rl_root);
//旋转动画
RotateAnimation animRotate = new RotateAnimation(0, 360,
        Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
animRotate.setDuration(1000);       //动画时间
animRotate.setFillAfter(true);      //保持动画结束状态
//缩放动画
ScaleAnimation animScale = new ScaleAnimation(0,1,0,1,
        Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
animScale.setDuration(1000);
animScale.setFillAfter(true);
//渐变动画
AlphaAnimation animAlpha = new AlphaAnimation(0,1);
animAlpha.setDuration(2000);
animAlpha.setFillAfter(true);
//动画集合
AnimationSet set = new AnimationSet(true);
set.addAnimation(animAlpha);
set.addAnimation(animRotate);
set.addAnimation(animScale);
//启动动画
rlRoot.startAnimation(set);
//设置动画监听
set.setAnimationListener(new Animation.AnimationListener() {
        //需要实现的方法
}

 

Android开发之动画整理

标签:

原文地址:http://www.cnblogs.com/cxsy/p/5596940.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!