Android动画:在Mac上像弹跳按钮

Juw*_*wei 3 java animation android button bounce

如果我在Mac OS X上打开一个应用程序,则该应用程序按钮会像球一样弹起,然后向上高2倍,然后再次升高。可以使用弹跳动画或其他某种动画来完成此操作吗?

Button希望从电话中跳出(稍稍增长),然后收缩2倍,然后再重新开始使用大按钮。就像将球从观众的眼睛直接向下投射到显示器一样。

我想引起用户的注意,该按钮正在等待被点击:)

这就是我得到的:

  <?xml version="1.0" encoding="utf-8"?>
  <set xmlns:android="http://schemas.android.com/apk/res/android">
  <scale
    android:duration="400"
    android:fromXScale="1"
    android:fromYScale="1"
    android:interpolator="@android:anim/bounce_interpolator"
    android:pivotX="50%"
    android:pivotY="50%"
    android:toXScale="1.1"
    android:toYScale="1.1"
    android:repeatCount="4" />
Run Code Online (Sandbox Code Playgroud)

然后开始

Animation bounce = AnimationUtils.loadAnimation(5his, R.anim.bounce);
somebutton.startAnimation(bounce);
Run Code Online (Sandbox Code Playgroud)

但是它只是在400秒内增加到110%,然后又从100%重新开始。无弹跳效果。

有任何想法吗?

Juw*_*wei 5

啊,bounce_interpolator已经在做我想要的了,我只需要给动画更多的时间... android:duration =“ 1000”可以解决问题,400ms太快了,无法看到弹跳动画。