如何清除它们在ListView的RECYCLEBIN所持的观点? [英] How to clear the views which are held in the ListView's RecycleBin?

查看:134
本文介绍了如何清除它们在ListView的RECYCLEBIN所持的观点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android的的ListView 部件,在的ListView 将举行这是从得到的意见一个适配器的getView 在一个内部类方法 RECYCLEBIN

In Android's ListView widget, the ListView will hold the views which is got from getView method of an Adapter in a inner class RecycleBin.

我怎样才能清除 RECYCLEBIN 的意见,并迫使的ListView 重新创建所有的子视图。

How can I clear the views in the RecycleBin and force the ListView to recreate all the child views.

推荐答案

如果我没有记错的呼叫废止的ListView 部件将清空浏览这是目前保存在缓存中。我建议不要放空的意见的ListView的缓存由于潜在的性能问题。

If I remember correctly a call to invalidate on a ListView widget will empty the cache of Views which are currently stored. I would advise against emptying the cache of views of a ListView because of the potential performance issues.

如果你不打算使用 convertView 的项目,那么你会拥有有建行查看各个时间(导致大量的对象构造每当用户滚动)+从回收的观点占据了额外的内存 RECYCLEBIN ,永不反正使用。

If you're not going to use the convertView item then you'll end up with having to build the row view each time(resulting in a lot of objects constructed each time the user scrolls) + the extra memory occupied by the recycled views from the RecycleBin which will never be used anyway.

这篇关于如何清除它们在ListView的RECYCLEBIN所持的观点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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