开发者

Android: AutoCompleteTextView - how to customize sort order

开发者 https://www.devze.com 2022-12-17 16:23 出处:网络
The normal way how AutoCompleteTextView shows suggestions, is that it shows only strings that begin with the text the user entered, but the sort order of the results is undefined.

The normal way how AutoCompleteTextView shows suggestions, is that it shows only strings that begin with the text the user entered, but the sort order of the results is undefined.

Can I somehow sort them by myself?

So that when user enters e.g. "g", I show him results beginning w开发者_运维问答ith "g" that are most relevant for him.


I suspect that if you implement a custom Filter and return it as part of your ListAdapter & Filterable implementation that you hand to the AutoCompleteTextView, that you can achieve your goal that way, but I have not tried this.

0

精彩评论

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

关注公众号