本文主要是介绍android 自转动画,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1.项目上一个简单需求,一个自旋转的imageview。
动画效果的代码:
Animation animation = AnimationUtils.loadAnimation(mContext, R.anim.img_animation);
LinearInterpolator interPolator = new LinearInterpolator();// 设置动画匀速运动
animation.setInterpolator(interPolator);
imgWorld.startAnimation(animation);
对应的R.anim.img_animation的代码
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" ><rotateandroid:duration="5000"android:fromDegrees="0"android:pivotX="50%"android:pivotY="50%"android:repeatCount="-1"android:repeatMode="restart"android:toDegrees="360" /></set>
<
这篇关于android 自转动画的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!