夥計。我有這樣的代碼(的AsyncTask)RotateAnimation無持續時間
我的動畫()函數:
public void animation()
{
int currentRotation = 0;
anim = new RotateAnimation(currentRotation, (360*4),
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,0.5f);
currentRotation = (currentRotation + 45) % 360;
anim.setInterpolator(new LinearInterpolator());
anim.setDuration(4000);// i want rotating without this <------------------
anim.setFillEnabled(true);
anim.setFillAfter(true);
refresh.startAnimation(anim);
}
誰能告訴我這是可能做到這一點,而不anim.setDuration
???? 只是開始..當我按下按鈕(例如)動畫停止。 請幫幫我。 問候,彼得。
最終代碼:
public void animation()
{
int currentRotation = 0;
anim = new RotateAnimation(currentRotation, (360*4),
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,0.5f);
currentRotation = (currentRotation + 45) % 360;
anim.setInterpolator(new LinearInterpolator());
anim.setDuration(4000);
// anim.setRepeatMode(Animation.INFINITE);
anim.setRepeatCount(Animation.INFINITE);
anim.setFillEnabled(true);
anim.setFillAfter(true);
refresh.startAnimation(anim);
}
和地方refresh.clearAnimation();
爲停止動畫 這對我的工作完美..如果這裏有些東西錯了 - 請告訴我..總之謝謝你的答案:)
謝謝你,老兄。這非常有幫助 – Peter 2011-06-02 13:58:00