我想在我的应用程序中显示动画,我希望每个3000m / s显示这个动画。
我在下面编写代码,但在此代码中只显示一次。
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
YoYo.with(Techniques.Bounce)
.duration(1500)
.playOn(arrowHelpImage);
}
}, 3000);
如何编辑我的代码并显示每个3000米/秒?
答案 0 :(得分:0)
YoYo.with(Techniques.Bounce)
.duration(1200)
.interpolate(new AccelerateDecelerateInterpolator())
.withListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {}
@Override
public void onAnimationEnd(Animator animation) {
YoYo.with(Techniques.Bounce)
.duration(1200)
.interpolate(new AccelerateDecelerateInterpolator())
.withListener(this).playOn(arrowHelpImage);
}
@Override
public void onAnimationCancel(Animator animation) {}
@Override
public void onAnimationRepeat(Animator animation) {}
}).playOn(arrowHelpImage);
答案 1 :(得分:0)
将以下代码放在班上。
private Handler handler;
private Runnable runnable;
在你的代码下面创建
handler = new Handler();
runnable = new Runnable() {
@Override
public void run() {
YoYo.with(Techniques.Bounce)
.duration(1500)
.playOn(arrowHelpImage);
handler.postDelayed(runnable, Constants.SPLASH_DURATION);
}
};
handler.postDelayed(runnable, Constants.SPLASH_DURATION);
@Override
protected void onDestroy() {
super.onDestroy();
//Close the handler and the process of splash screen.
if (handler != null && runnable != null) {
handler.removeCallbacks(runnable);
}
}