我有一个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