2013-03-05 101 views
0

在Android最近幾天工作,我想通過按下按鈕來旋轉箭頭。使用RotateAnimation和:Android旋轉動畫重疊

setFillAfter(true); 

箭頭保持在最後的位置,應該如此。 但是,當我再次按下按鈕時,箭頭yes開始從初始位置旋轉,但也有最後一次由「新」箭頭重疊的動畫調用中的「上一個」箭頭。所以我想我需要以某種方式重置/清除setFillAfter但我找不到方法。

我的代碼是這樣的:

//Animation start 
float Xaxis=0.835366f; 
float Yaxis=0.676692f; 
RotateAnimation rotateAnimation1 = new RotateAnimation(0, 180, 
    Animation.RELATIVE_TO_SELF, Xaxis,Animation.RELATIVE_TO_SELF, Yaxis); 
rotateAnimation1.setInterpolator(new LinearInterpolator()); 
rotateAnimation1.setDuration(2500); 
rotateAnimation1.setRepeatCount(0); 
image.startAnimation(rotateAnimation1); 
rotateAnimation1.setAnimationListener(this); 

@Override 
public void onAnimationEnd(Animation animation) { 
    animation.setFillAfter(true); 
} 

任何意見將是有益的.. 我已經試過無效,clearAnimation圖像,設置fillafter爲false,重置動畫,但仍然相同。

+0

嘗試'setFillBefore' – abc667 2013-03-05 16:32:54

+0

你必須在onAnimationEnd中改變你的箭頭位置,是的!你設置setFillAfter(true);但是在動畫之後顯示的位置不是箭頭 – Intathep 2013-03-05 16:44:14

+0

的實際位置,並且調用setAnimationListener(this);開始之前動畫 – Intathep 2013-03-05 16:45:26

回答

0

它是固定的,模擬器配置有共享的GPU並且運行完美。快速,沒有任何以前的動畫剩餘。