-1

我在 ICS 上遇到了一个错误。使用 ListView 并随着时间的推移更改适配器,在向下滚动然后返回顶部之前,我看不到 listView 的内容有任何变化。我使用这些命令来通知适配器的更改:

adap.notifyDataSetChanged();
adap.notifyDataSetInvalidated();//added just to see if it solved... but it didn't resolve

在 Gingerbread 中,代码运行良好。

4

1 回答 1

0

每次像这样填充 ListView 时,还要创建一个新适配器:

adapter = new ListViewCustomAdapter(SearchAssetActivity.this, itemList);
lview3.setAdapter(adapter);
adapter.notifyDataSetChanged();

至于为什么notifyDataSetChanged()不起作用。请通过这个。即使我面临类似的问题。

notifyDataSetChanged 示例

于 2012-07-20T09:45:22.863 回答