如何在移动应用程序中使Android动画像圆圈一样旋转
谁能帮我弄清楚如何在Moves应用程序中为他们的圈子制作这个动画。我附上了一个GIF解释它 我在圆圈上单击了三次,每次单击,动画就完成了 如果我能使用ViewPropertyAnimator API来完成,那就太好了如何在移动应用程序中使Android动画像圆圈一样旋转,android,android-animation,Android,Android Animation,谁能帮我弄清楚如何在Moves应用程序中为他们的圈子制作这个动画。我附上了一个GIF解释它 我在圆圈上单击了三次,每次单击,动画就完成了 如果我能使用ViewPropertyAnimator API来完成,那就太好了 这看起来像是一个ScaleAnimation。 在代码中,这可能看起来像这样: ScaleAnimation anim = new ScaleAnimation(1, 1.20f, 1f, 1.20f, centerX, centerY); anim.setDuration(100
这看起来像是一个
ScaleAnimation
。
在代码中,这可能看起来像这样:
ScaleAnimation anim = new ScaleAnimation(1, 1.20f, 1f, 1.20f, centerX, centerY);
anim.setDuration(100);
anim.setRepeatCount(2);
anim.setRepeatMode(Animation.REVERSE);
view.startAnimation(anim);
在XML中:
<scale xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="100"
android:fromXScale="1"
android:fromYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="2"
android:repeatMode="reverse"
android:toXScale="1.25"
android:toYScale="1.25" />
双脉冲是由于重复计数被设置为2,请尝试一下,看看哪些设置最适合您。我无法将GIF直接上传到问题…制作GIF并在应用程序加载时显示。@hoperunsdeph但我希望在用户单击圆圈时完成此操作。有没有更好的方法呢?你想让动画在用户点击3次后结束?我不明白。@HoperUnsdeph不,动画每次单击只运行一次。我可以用
ViewPropertyAnimator
执行此操作吗?ViewPropertyAnimator
不支持重复。