我有我的listView適配器,我想更新我的適配器使用NotifyDataSetChanged(),但它不適用於我。這就是我在我的適配器添加數據:Adapter.NotifyDataSetChanged不起作用
if (Messages.Count != 0) {
ChatAdapter = new BubbleAdapter (this, Messages);
if(listViewChat.Adapter == null) {
listViewChat.Adapter = ChatAdapter;
} else {
ChatAdapter.NotifyDataSetChanged();
}
}
但是就像我說如果我更新使用這種方式不工作... ,我的ListView是滾動到頂部:
ChatAdapter = new BubbleAdapter (this, Messages);
listViewChat.Adapter = ChatAdapter;
消息是一個對象數組嗎? – sUndeep 2015-02-10 09:24:58
它是List。消息泡泡這是我的課,我有消息和一些關於消息的數據 –
Adept22
2015-02-10 09:31:40
請看下面提到的修改後的代碼。我也面臨同樣的問題,並且解決了這個想法。 – sUndeep 2015-02-10 09:33:52