我确定我只有一个ImageLoader实例,所以我知道这不是问题,因为某些原因,它只在显示从网络加载的全新图像时才会出现问题。所以我认为它与UI的口吃有关,因为它解码图像,但我通过Universal Image Loader异步处理所有内容。这是我的BaseAdapter的getView方法。Listview上的通用图像加载器是laggy
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
JSONObject thePost = null;
try {
thePost = mPosts.getJSONObject(position).getJSONObject("data");
} catch (Exception e) {
System.out.println("errreoroer");
}
LinearLayout postItem = (LinearLayout) inflater.inflate(R.layout.column_post, parent, false);
String postThumbnailUrl = null;
try {
//parse thumbnail
postThumbnailUrl = thePost.getString("thumbnail");
} catch (Exception e) {}
//grab the post view objects
ImageView postThumbnailView = (ImageView)postItem.findViewById(R.id.thumbnail);
if (!(postThumbnailUrl.equals("self") || postThumbnailUrl.equals("default") || postThumbnailUrl.equals("nsfw")))
mImageLoader.displayImage(postThumbnailUrl, postThumbnailView);
return postItem;
}
[这个I/O通话(http://youtu.be/wDBM6wVEO70)中含有宝贵的洞察的ListView的话题(和其中大部分适用于其他AdapterViews)我强烈建议您观看本次演讲,以便了解推动优化的机制。 – FoamyGuy 2013-04-22 15:43:26