我正在做一个应用程序,我显示从设备到ListView(名称,数字,图像)的所有联系人 . 我想使用工具栏搜索从ListView中搜索联系人 . 我添加了搜索工具栏,但我不知道如何从列表中过滤联系人 . 请任何人帮助我 .
我使用this example在ListView中显示联系人 .
我正在做一个应用程序,我显示从设备到ListView(名称,数字,图像)的所有联系人 . 我想使用工具栏搜索从ListView中搜索联系人 . 我添加了搜索工具栏,但我不知道如何从列表中过滤联系人 . 请任何人帮助我 .
我使用this example在ListView中显示联系人 .
2 回答
尝试下面的代码它工作正常:
Create MainActivity.class:
Create your customAdapter class:
Create POJO Class
Create MainActivity.xml file:
Create row Item layout file:
create toolbar.xml in layout folder:
Create menu_search.xml in menu folder:
add below code in style.xml file:
add below code in AndroidManifest.xml:
尝试从Android开发者页面实现代码:Retrieve a list of contacts
它更快更稳定 .