Android:AutoCompleteTextView 在没有输入文本时显示建议

标签 android autocompletetextview

我正在使用 AutoCompleteTextView,当用户点击它时,即使它没有文本,我也想显示建议 - 但 setThreshold(0) 的工作原理完全相同如 setThreshold(1) - 所以用户必须输入至少 1 个字符才能显示建议。

最佳答案

这是documented behavior :

When threshold is less than or equals 0, a threshold of 1 is applied.

您可以通过 showDropDown() 手动显示下拉菜单,因此您可以安排在需要时显示它。或者,子类 AutoCompleteTextView 并覆盖 enoughToFilter(),始终返回 true

关于Android:AutoCompleteTextView 在没有输入文本时显示建议,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2126717/

相关文章:

java - AutoCompleteTextView 上自动完成多个值

android - 忽略 AutoCompleteTextView 下拉样式

android - 如何获取在 AutoCompleteTextView 中选择的文本的索引

java - Android 应用程序在向下滚动到 ListView 中的第三项并出现位图错误后崩溃

Android - 让应用程序全屏没有标题和图标?

android - Flutter - 如何使用包含表单的可扩展面板构建 ListView ?

android - 一直调用 AutoCompleteTextView 的 performFiltering

android - 如何在android中为 map 标记提供标签

android - 在 Root 设备 Android 上更改动态壁纸

android - 如何从 HashMap 绑定(bind) AutoCompleteTextView