How to refer to the original position of a list item when text filter is enabled?

后端 未结 4 889
甜味超标
甜味超标 2021-01-15 13:58

When I use edit text to filter the items, the list positions get all messed up and the items no longer call the proper intent. Any help is appreciated

lv.se         


        
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-15 14:23

    The item position is not reliable when using lists. I recommend you to use view.setTag(Object) to assign an identifier to each item when attaching the content. This could be a number, string or anything. Then you can just access it with view.getTag() inside the click listener.

提交回复
热议问题