2017-04-24 107 views
1

我在我的代碼中有一個動畫。 但我希望當我點擊按鈕我的ImageView返回到原來的地方(重置動畫) 我有一個方法。 我的代碼是:

ImageView清除動畫

private void returnToOriginalRotationState() { 
    RotateAnimation animation = new RotateAnimation(0.0f, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f); 
    animation.setInterpolator(new LinearInterpolator()); 
    animation.setDuration((long) 2*1000); 
    animation.setFillAfter(true); 
    animation.setFillEnabled(true); 
    imgHeade.startAnimation(animation); 
} 


它的工作原理以及

animation.setDuration((long) 2*1000); 


不工作!

回答

1

嘗試一下本作明確的動畫:

imgHeade.clearAnimation(); 
+0

感謝,但我想清除與延遲動畫 –