EditText 的自定义字典
是否可以为编辑文本创建自定义词典?换句话说,我可以创建一个自定义列表并让 edittext 仅建议该列表中的名称吗?当用户输入特定的人名时,我不需要它弹出无用的单词建议。
Is it possible to create a custom dictionary for an edittext? In other words, can I create a custom list and have the edittext only suggest names from that list? I don't need it popping up useless word suggestions when the user is inputting specific names of people.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请参考此链接。
https://developer.android.com/resources/samples/SearchableDictionary/index.html他们
将实现内容提供程序来为快速搜索提供自定义输入。您可以尝试采用类似的方法,当用户在 EditText 框中输入每个字母时,您可以进行查询并更新结果。
Please refer to this link.
https://developer.android.com/resources/samples/SearchableDictionary/index.html
They would have implemented content provider to provide a custom input to the quicksearch. You can try taking a similar approach where in you can make a query and update the result when a user enters each alphabet in your EditText box.
使用 AutoCompleteTextView 并在适配器中提供您的字典。
http://developer.android.com/guide/topics/ui/控件/text.html
Use AutoCompleteTextView and provide your dictionary in the adapter.
http://developer.android.com/guide/topics/ui/controls/text.html