Android Viewpager 动画断断续续
我在 ViewPager
中添加了大约 4 个(列表)视图,它充当 TabHost
的控制器。与此处找到的示例类似的内容:
当我滑动手指转到下一个时看来,不是很顺利。我使用 setDrawingCacheEnabled(true);
来改进动画。不过,看起来还是很不稳定。 任何人都可以提供任何指导来获得流畅的动画吗?
I have around 4 (list)views added to my ViewPager
which acts as a controller to a TabHost
. Something similar to example found here :
When I fling my finger to go to next view, its not very smooth. I have used the setDrawingCacheEnabled(true);
to improve on the animation. Still, it seems choppy.
Can anyone provide any guidelines to have smooth animations ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这里只是一个大胆的猜测,但是填充 ListViews 是否可能需要太多时间,从而导致动画断断续续,因为 ViewPager 必须等待下一个 View 被实例化?我也遇到过类似的问题,我发现原因是在 ListAdapter 的 getView() 中调用 SQLite 函数,导致延迟。
Just a wild guess here, but is it possible that populating the ListViews takes too much time, thus causing the choppy animations as the ViewPager has to wait for the next View to be instantiated? I've had a similar problem, the cause of which I found out to be SQLite functions being called in a ListAdapter's getView(), causing the delay.
尝试在扩展 pagerAdapter 示例的 Adapter 处设置布局参数
try set the layout parameters at Adapter which extends the pagerAdapter example