android 实现控件的旋转动画效果
2014-05-06 22:28
651 查看
在程序开发中有时候需要让某一个空间旋转一定角度,或者是无限旋转(类似Progressbar)。
其实实现起来也很简单:
[java] view
plaincopy
RotateAnimation mFlipAnimation;
mFlipAnimation = new RotateAnimation(0, 45, RotateAnimation.RELATIVE_TO_SELF, 0.5f,
RotateAnimation.RELATIVE_TO_SELF, 0.5f);
mFlipAnimation.setInterpolator(new LinearInterpolator());
mFlipAnimation.setDuration(80);//如果参数是0,就是无限旋转
mFlipAnimation.setFillAfter(true);
然后就是控件的操作:
[java] view
plaincopy
your_button.clearAnimation();
your_button.startAnimation(mFlipAnimation);
我实现的效果是你点击的你的button,然后你的button就会旋转45度。
其实实现起来也很简单:
[java] view
plaincopy
RotateAnimation mFlipAnimation;
mFlipAnimation = new RotateAnimation(0, 45, RotateAnimation.RELATIVE_TO_SELF, 0.5f,
RotateAnimation.RELATIVE_TO_SELF, 0.5f);
mFlipAnimation.setInterpolator(new LinearInterpolator());
mFlipAnimation.setDuration(80);//如果参数是0,就是无限旋转
mFlipAnimation.setFillAfter(true);
然后就是控件的操作:
[java] view
plaincopy
your_button.clearAnimation();
your_button.startAnimation(mFlipAnimation);
我实现的效果是你点击的你的button,然后你的button就会旋转45度。
相关文章推荐
- android 实现控件的旋转动画效果
- Android中使用Animation实现控件的动画效果以及Interpolator和AnimationListener的使用
- Android Tween动画之RotateAnimation实现图片不停旋转效果实例介绍
- android 动画rotate实现图片不停旋转的效果
- Android编程实现RotateAnimation设置中心点旋转动画效果
- Android中使用Animation实现控件的动画效果以及Interpolator和AnimationListener的使用
- Android基础控件——ProgressBar自定义的介绍、动画效果实现、附加三个漂亮的进度条
- android 控件动画效果实现
- android 视图动画的使用,Animation重写 实现旋转效果
- Android进阶——自定义View之继承系统控件实现自带删除按钮动画效果和软键盘自动悬浮于文本框下方
- Android Tween动画之RotateAnimation实现图片不停旋转效果实例介绍
- Android使用Rotate3dAnimation实现3D旋转动画效果的实例代码
- Android仿饿了么加入购物车旋转控件自带闪转腾挪动画的按钮效果(实例详解)
- Android中使用Animation实现控件的动画效果以及Interpolator和AnimationListener的使用
- Android中使用Animation实现控件的动画效果以及Interpolator和AnimationListener的使用
- android 布局实现旋转动画效果
- Android中如何使用rotate实现图片不停旋转的效果与动画的停止
- [Android]ScaleViewPager--仿“想去”客户端图片展示效果--中轴旋转ViewPager动画实现
- Android 3D旋转动画效果实现分解
- Android实现控件动画效果