Android动画 之 Tween Animation(RotateAnimation 旋转动画)
2012-05-21 11:02
375 查看
public class
一、配置xml文件
fromDegrees 起始图片的角度
toDegrees 结束时图片的角度
pivotX pivotY 旋转的环绕坐标
二、开启动画
附:animation公共属性设置
From class android.view.animation.Animation
RotateAnimation
extends Animationjava.lang.Object | ||
↳ | android.view.animation.Animation | |
↳ | android.view.animation.RotateAnimation |
<?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromDegrees="0.0" android:toDegrees="360.0" android:repeatCount="20" android:duration="500" android:pivotX="160.0" android:pivotY="240.0" > </rotate>
fromDegrees 起始图片的角度
toDegrees 结束时图片的角度
pivotX pivotY 旋转的环绕坐标
二、开启动画
iv_show = (ImageView) findViewById(R.id.iv_show); final RotateAnimation aa = (RotateAnimation) AnimationUtils .loadAnimation(this, R.anim.anim_rotate); iv_show.startAnimation(aa);
附:animation公共属性设置
From class android.view.animation.Animation
Attribute Name | Related Method | Description |
android:detachWallpaper | setDetachWallpaper(boolean) | Special option for window animations: if this window is on top of a wallpaper, don't animate the wallpaper with it. |
android:duration | setDuration(long) | Amount of time (in milliseconds) for the animation to run. |
android:fillAfter | setFillAfter(boolean) | When set to true, the animation transformation is applied after the animation is over. |
android:fillBefore | setFillBefore(boolean) | When set to true, the animation transformation is applied before the animation has started. |
android:fillEnabled | setFillEnabled(boolean) | When set to true, fillAfter is taken into account. |
android:interpolator | setInterpolator(Interpolator) | Defines the interpolator used to smooth the animation movement in time. |
android:repeatCount | setRepeatCount(int) | Defines how many times the animation should repeat. |
android:repeatMode | setRepeatMode(int) | Defines the animation behavior when it reaches the end and the repeat count is greater than 0 or infinite. |
android:startOffset | setStartOffset(long) | Delay in milliseconds before the animation runs, once start time is reached. |
android:zAdjustment | setZAdjustment(int) | Allows for an adjustment of the Z ordering of the content being animated for the duration of the animation. |
相关文章推荐
- Android Tween动画之RotateAnimation实现图片360°不停旋转
- Android Tween动画之RotateAnimation实现图片不停旋转
- Android Tween动画之RotateAnimation实现图片不停旋转
- Android Tween动画之RotateAnimation实现图片不停旋转
- Android Tween动画之RotateAnimation实现图片不停旋转
- Android Tween动画之RotateAnimation实现图片不停旋转
- Android Tween动画之RotateAnimation实现图片不停旋转
- Android Tween动画之RotateAnimation实现图片不停旋转
- Android Tween动画之RotateAnimation实现图片不停旋转
- Android Tween动画之RotateAnimation实现图片不停旋转
- Android Tween动画之RotateAnimation实现图片不停旋转
- Android Tween动画之RotateAnimation实现图片不停旋转
- Android Tween动画之RotateAnimation实现图片不停旋转
- Android Tween动画之RotateAnimation实现图片不停旋转
- Android Tween动画之RotateAnimation实现图片不停旋转效果实例介绍
- Android Tween动画之RotateAnimation实现图片不停旋转效果实例介绍
- Android Tween动画之RotateAnimation实现图片不停旋转
- Android Tween动画之RotateAnimation实现图片不停旋转
- Android Tween动画之RotateAnimation实现图片不停旋转
- Android Tween动画之RotateAnimation实现图片不停旋转