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

Android 旋转动画,停止和持续旋转

2015-08-03 19:03 417 查看
旋转180度后停止

RotateAnimation rotate;
rotate =new RotateAnimation(0f,180f,Animation.RELATIVE_TO_SELF,
0.5f,Animation.RELATIVE_TO_SELF,0.5f);
rotate.setDuration(1000);
rotate.setFillAfter(true);
image.startAnimation(rotate);


持续旋转,不停止

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" >

<rotate
android:duration="2000"
android:fromDegrees="0"
android:interpolator="@android:anim/linear_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="-1"
android:repeatMode="restart"
android:startOffset="-1"
android:toDegrees="+360" />

</set>

rotate = AnimationUtils.loadAnimation(MychoiceActivity.this, R.anim.dialog_loading_animation);
image.startAnimation(rotate);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: