AutoCompleteTextView doesn't recognize spaces

≯℡__Kan透↙ 提交于 2019-12-23 13:07:21

问题


I'm using an AutoCompleteTextView in my Android application, which is loaded with items like this one:

"Smoky chinchilla rat - Abrocoma cinerea"

Which are common names and scientific names of many animals...

Now, if I type "smo" is fine, the item above is shown nicely, the problem starts when I type things like "abrocoma " (note the space)... the instant I type the space after "abrocoma" the selections dissapear, as if the sequence "abrocoma " doesn't appear in the line...

The above is only true for spaces after the first word... If I type "smoky " is fine...

More, if I type "smoky chinchilla rat - abrocoma " it still shows the dropdown just fine, the only problem is when I start with any word but the first.

I don't know if this is an error of the AutoCompleteTextView or my code.

Any direction is appreciated.

Greetings


回答1:


Have you taken a look at this post? The user was having a similar issue, and he wrote is own derivation:

I just ran into a similar problem and wrote a simple multi word derivation. It defaults to a "," separator but you can set it whatever you like using the "setSeparator" method.



来源:https://stackoverflow.com/questions/8233262/autocompletetextview-doesnt-recognize-spaces

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!