ListView的放缓ViewPager刷卡 [英] ListView slowing down ViewPager swipe

查看:167
本文介绍了ListView的放缓ViewPager刷卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含从网上下载一个ImageViews和ViewPager幻灯片它只是罚款时,我的ListView(在另一个单独的布局)未初始化。

I have a ViewPager that contains ImageViews downloaded from the net and it slides just fine when my ListView (in another separate layout) is not initialized.

但创造了我的ListView出现问题的时候开始。该ViewPager仍然是幻灯片,但只是幻灯片的方式约1/4,滞后,然后正确加载下一个ImageView的。

But the problems start when my ListView is created. The ViewPager still "slides" but only slides about 1/4 of the way, lags, then loads the next ImageView correctly.

所有网络和位图操作的正在使用的AsyncTask完成。我也从单独API 其中工程pretty以及使用的RemoteImageCache API。

All of the network and bitmap operations are done using AsyncTask. I've also used the RemoteImageCache API from Singly API which works pretty well.

任何想法,为什么ViewPager的刷卡滞后?

Any ideas as to why ViewPager's swipe is lagging?

推荐答案

慢下来是由ListView控件调用getView超过必要的(超过我的列表中每个项目的3倍)引起的。

The slow down was caused by the ListView calling getView more than necessary (more than 3x per item in my list).

根据该<一个href=\"http://stackoverflow.com/questions/11186004/yet-another-getview-called-multiple-times\">solution, ListView的宽度和高度必须给出具体的数值,而不是 WRAP_CONTENT 或者 getView()将被调用多次。

According to this solution, the ListView's width and height must be given specific values and not wrap_content or else getView() will be called multiple times.

这篇关于ListView的放缓ViewPager刷卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆