开发者

Advanced AutoCompleteTextView. Many-to-one map

开发者 https://www.devze.com 2023-02-17 03:38 出处:网络
I want the autocomplete view to display multiple items for the same text item. ie. with an input data, {{a,b,c,开发者_如何学运维d}, {e,f,g,h}} the user could search and start typing in b, but only 1

I want the autocomplete view to display multiple items for the same text item.

ie. with an input data, {{a,b,c,开发者_如何学运维d}, {e,f,g,h}} the user could search and start typing in b, but only 1 item from a,b,c,d would be displayed in the autocomplete section.

How would I go about this?

Thanks


I found I could solve this problem by adding all the elements to the autocompletetextview like normal

However, for the items that had "aliases" I put them in as 1 item, separated by a separator character and a space. The space allowed the item to be selected using the normal functionality. Then I used a custom view for each of the items which identified which 'part' of the string was being entered and displayed that part in the dropdown item.

For my solution, I then hide the autocompletetextview, but you could also just call setText to overwrite the default behavior.

0

精彩评论

暂无评论...
验证码 换一张
取 消