[英]make custom filter for autocompletetextview android
hi my task is simple that make a autocompletetextview
and show matched text in dropdown
. 您好,我的任务很简单,可以创建
autocompletetextview
并在dropdown
显示匹配的文本。 But i want to change in filter. 但是我想改变过滤器。
Ex: my list
is like DYPatil College
, Pune unversiry
etc. I want that when user type dy
or dyp
it stat matching and display result. 例如:我的
list
就像DYPatil College
, Pune unversiry
等。我希望当用户键入dy
或dyp
它统计匹配并显示结果。
How could i ignore whitespace
and dot. 我怎么能忽略
whitespace
和点。
And also Could u plz tell me to how exactly autocompletetextview
works. 而且您能否告诉我
autocompletetextview
工作原理。
Using by default adapter and filter, autocompletetextview
can do only single line string in dropdown view as default adapter and default filter adapter.getFilter().filter(s.toString());
默认情况下,
autocompletetextview
使用适配器和过滤器,只能在下拉视图中作为默认适配器和默认过滤器适配器使用单行字符串adapter.getFilter().filter(s.toString());
which can do filtering with condition of inputString.contains(stringOfList)
one-bye-one and get and display that list in dropdown at autocompletextview. 它可以与
inputString.contains(stringOfList)
条件进行inputString.contains(stringOfList)
过滤,并在autocompletextview的下拉列表中获取并显示该列表。
There for you have to make simple custom adapter
and inside that custom filter class
for filtering as per your requirement. 您必须在其中创建简单的
custom adapter
并inside that custom filter class
进行过滤,以根据您的要求进行过滤。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.