1
即時嘗試設置動畫監聽器,所以最終objectanimators發生了一些事情!這裏是我的代碼到目前爲止:Android動畫設置監聽器不工作
as=new AnimatorSet();
as.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
om.Initialize();
System.out.println("GotIn");
DataBase.eaten=false;
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
float distance=CalcDistance();
float angle=CalcAngle();
tongue.setPivotX(2);
tongue.setPivotY(0);
rotate_tongue=ObjectAnimator.ofFloat(tongue, "rotation",0,90+angle);
rotate_tongue.setDuration(0);
rotate_tongue.start();
tongue.setVisibility(View.VISIBLE);
scale_tongue=ObjectAnimator.ofFloat(tongue,"scaleY",1.0f,1.0f*(distance/4));
scale_tongue.setDuration(500);
shrink_tongue=ObjectAnimator.ofFloat(tongue,"scaleY",1.0f*(distance/4),1.0f);
shrink_tongue.setDuration(400);
as.play(rotate_tongue).with(scale_tongue).before(shrink_tongue);
as.start();
問題是,聽衆does not實際工作,因爲沒有什麼反應,當animatorsetend!如何解決這個問題?謝謝 !
你有沒有找到答案?我有同樣的問題。 – JayRod 2015-08-17 23:05:44