Android:AutoCompleteTextView 在未输入文本时显示建议 [英] Android: AutoCompleteTextView show suggestions when no text entered
问题描述
我正在使用 AutoCompleteTextView
,当用户点击它时,即使它没有文本,我也想显示建议 - 但 setThreshold(0)
的工作原理完全相同如 setThreshold(1)
- 所以用户必须输入至少 1 个字符才能显示建议.
I am using AutoCompleteTextView
, when the user clicks on it, I want to show suggestions even if it has no text - but setThreshold(0)
works exactly the same as setThreshold(1)
- so the user has to enter at least 1 character to show the suggestions.
推荐答案
这是 记录的行为:
当threshold
小于等于0时,阈值为1已申请.
When
threshold
is less than or equals 0, a threshold of 1 is applied.
您可以通过 showDropDown()
手动显示下拉菜单,因此也许您可以安排在需要时显示它.或者,子类化 AutoCompleteTextView
并覆盖 enoughToFilter()
,始终返回 true
.
You can manually show the drop-down via showDropDown()
, so perhaps you can arrange to show it when you want. Or, subclass AutoCompleteTextView
and override enoughToFilter()
, returning true
all of time.
这篇关于Android:AutoCompleteTextView 在未输入文本时显示建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!