Android Listview Search filter

后端 未结 2 1520
太阳男子
太阳男子 2021-01-27 08:48

I am trying to make a list view search for Android. I have found many tutorials that do just that where a search-bar is placed at the top and if you type in the box the results

相关标签:
2条回答
  • 2021-01-27 09:16

    Rather than products[position], use adapter.getItem(position). When the ListView is not in filter mode, those two things will be the same. But, in filter mode, getItem() will take the filtering into account.

    0 讨论(0)
  • 2021-01-27 09:25

    The ListAdapter will change the relative position of the items it currently shows due to the filtering. You should always use getItem(position) to retrieve the correct item.

    0 讨论(0)
提交回复
热议问题