public class AnimUtil {
private static Animation rotateAnim = null;
public static void startViewAnim(View view) {
if (view == null) {
return;
}
//从左向右
if (rotateAnim == null) {
rotateAnim = new RotateAnimation(-10f, 10f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
}
rotateAnim.setDuration(100);
rotateAnim.setRepeatMode(Animation.REVERSE);
rotateAnim.setRepeatCount(-1);
AnimationSet smallAnimationSet = new AnimationSet(false);
smallAnimationSet.addAnimation(rotateAnim);
view.startAnimation(smallAnimationSet);
}
public static void stopViewAnim() {
if (rotateAnim != null) {
rotateAnim.cancel();
rotateAnim = null;
}
}
}
Android 呈X形状,以交叉点左右抖动
最新推荐文章于 2024-05-14 09:10:49 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)