您的位置:首页 > 移动开发 > Android开发

android中3种实现动画效果的方法

2013-12-14 20:37 513 查看
3中实现动画的方法:
ImageView imgView = (ImageView)findViewById(R.id.imageView_logo);

//第一种动画方法,使用AlphaAnimation实现动画(图片由暗变亮的过程)
//animation = new AlphaAnimation(0.0f, 1.0f);
//第二种动画方法,使用ScaleAnimation实现,动画由小变大
animation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
//下面是第三种方法,但是后面的两个参数不理解(随便赋值的),不过也能够实现
//animation = new RotateAnimation(TRIM_MEMORY_COMPLETE, BIND_ABOVE_CLIENT);

animation.setDuration(1000); //动画开始到结束过程的持续时间
animation.setAnimationListener(animationListener);//设置动画的监听
imgView.startAnimation(animation);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: