是否有某些原因讓我無法在動畫偵聽器中提供的Animator上調用.cancel()?爲什麼在動畫偵聽器中調用.cancel()會導致StackOverflowError?
當我執行下面的代碼我得到的StackOverflowError:
animation.addListener(new ValueAnimator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
if (!showCircles)
animator.cancel();
}
....
如果你調用'animation.cancel()'會發生什麼? – tolgap
'動畫'不能從內部類中調用(除非它被聲明爲final)。 – gsysko