开发者

ListView add more items

开发者 https://www.devze.com 2023-02-02 10:35 出处:网络
I have a ListView and set a SimpleAdapter to s开发者_开发问答how some formated items, then how could i add other items to the items Listview with the old format.If you add more data to the List you su

I have a ListView and set a SimpleAdapter to s开发者_开发问答how some formated items, then how could i add other items to the items Listview with the old format.


If you add more data to the List you supplied in the SimpleAdapter constructor and then call mySimpleAdapter.notifyDataSetChanged() method afterwards the ListView will refresh itself.


You'll need to extend the BaseAdapter class and create a method addItem() that adds your item to the BaseAdapater's item model. Then you should call notifyDatasetChanged to have your listview updated.

There are tons of examples of this online and on SO.

0

精彩评论

暂无评论...
验证码 换一张
取 消