我有一個ViewFlipper,它在調用showPrevious時運行視圖動畫。動畫效果很好。但問題是,它以超過1秒的延遲開始。現在看起來並不多,但嚴重延遲了應用程序的使用。ViewFlipper具有'巨大'的延遲
我的動畫是這樣的;
Animation inFromLeft = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, -1.0f,
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f);
inFromLeft.setDuration(350);
inFromLeft.setInterpolator(new LinearInterpolator());
Animation outtoRight = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, +1.0f,
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f);
outtoRight.setDuration(350);
outtoRight.setInterpolator(new LinearInterpolator());
我設置使用setInAnimation
和setOutAnimation
動畫;
setInAnimation(inFromLeft);
setOutAnimation(outtoRight);
然後,我剛剛推出使用showPrevious
動畫是沒有任何理由的動畫與超過1秒的延遲啓動,該開始時間爲動畫是-1,開始偏移爲0。
解決方案是切換到ViewPager,動畫不完全是我想要的,但延遲消失了。將動畫更改爲XML不會改變任何內容。 – Thys 2012-09-06 07:49:46