200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > android 无限旋转动画 android ——不停旋转动画

android 无限旋转动画 android ——不停旋转动画

时间:2020-04-29 23:17:31

相关推荐

android 无限旋转动画 android ——不停旋转动画

xml文件

```

android:fromDegrees="359"

android:toDegrees="0"

android:duration="1000"

android:repeatCount="-1"

android:pivotX="50%"

android:pivotY="50%"/>

代码

/开始旋转/

public voidstartRotateAnimation(View view, intsetid) {

Animation rotateAnim = AnimationUtils.loadAnimation(this,setid);

LinearInterpolator lin =newLinearInterpolator();

rotateAnim.setInterpolator(lin);

if(rotateAnim !=null) {

view.startAnimation(rotateAnim);

}

}

/*

停止旋转

*/

public voidstopRotateAnimation(View v) {

v.clearAnimation();

}

```

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。