我有一个ViewFlipper,它在调用showPrevious时运行一个视图动画.动画效果很好.但问题是它开始延迟超过1秒.现在这似乎并不多,但它严重延迟了应用程序的使用.
我的动画看起来像这样;
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());
Run Code Online (Sandbox Code Playgroud)
我使用setInAnimation和设置动画setOutAnimation;
setInAnimation(inFromLeft);
setOutAnimation(outtoRight);
Run Code Online (Sandbox Code Playgroud)
然后我就用启动动画 showPrevious
动画的延迟超过1秒是否有任何原因,动画的startTime为-1,startOffset为0.
| 归档时间: |
|
| 查看次数: |
554 次 |
| 最近记录: |