从列表视图中删除项 [英] Remove item from listview

查看:128
本文介绍了从列表视图中删除项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从一个ListView在Android中移除项目?

How do you remove an item from a ListView in Android?

推荐答案

您需要更改底层数据源。

You need to change your underlying data source.

如果您使用的是 ArrayAdapter ,电话删除() ArrayAdapter 来删除的项,它会从列表中消失。

If you are using an ArrayAdapter, call remove() on the ArrayAdapter to remove the item, and it will vanish from the list.

如果您使用的是 SimpleCursorAdapter ,从数据库中删除或内容提供商的项目,然后调用重新查询()光标,并且该项目将从列表中消失。

If you are using SimpleCursorAdapter, remove the item from the database or content provider, then call requery() on the Cursor, and the item will vanish from the list.

这篇关于从列表视图中删除项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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