Android 动画标签——rotate
作用:旋转动画
<?xml version="1.0" encoding="utf-8"?>android:pivotX:缩放中心坐标的X值,取值类型有三种:数字;百分比;百分比+“p”;
android:pivotY*:缩放中心坐标的Y值;同上
android:duration:动画持续时长
android:interpolator:动画插值器。是实现动画不规则运动的一种方式;(先占个位置)
android:fillAfter:动画结束之后是否保持动画的最终状态;true,表示保持动画的最终状态
android:fillBefore:动画结束之后是否保持动画开始前的状态;true,表示恢复到动画开始前的状态
android:repeatCount:动画重复的次数。指定动画重复播放的次数,如果你需要无限循环播放,请填写一个小于0的数值,一般写-1
android:repeatMode:动画重复的Mode,有reverse和restart两种
android:startOffset:动画播放延迟时长,调用start之后延迟多少时间播放动画
android:duration:动画持续时长,毫秒为单位
android:fromDegrees:动画开始的角度
android:toDegrees:动画旋转的目标角度
使用方法:
1.xml 使用方式
RotateAnimation rotateAnimation = (RotateAnimation) AnimationUtils.loadAnimation(this,R.anim.my_rotate);
imageView.startAnimation(rotateAnimation);
2.代码使用方式
RotateAnimation rotateAnimation = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setFillAfter(true);// 设置保持动画最后的状态
rotateAnimation.setDuration(3000);// 设置动画时间
rotateAnimation.setRepeatCount(-1);//设置重复次数
imageView.startAnimation(rotateAnimation);
更多相关文章
- Android 动画标签——translate
- android动画源码合集、动态主题框架、社交app源码等
- Android隐藏状态栏和标题栏
- Android 无闪烁启动画面程序源码
- android图片切换ImageSwichter的动画切换效果
- Android动画学习
- Android中的drawable state的各种状态
- android logo:内核、android开机动画
- Android百分比布局:PercentFrameLayout