简体   繁体   中英

ListView add more items

我有一个ListView并设置了一个SimpleAdapter以显示某些格式的项目,然后如何将其他项目添加到具有旧格式的项目Listview中。

如果将更多数据添加到您在SimpleAdapter构造函数中提供的List中,然后调用mySimpleAdapter.notifyDataSetChanged()方法,则ListView将刷新自身。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM