安卓:AutoCompleteTextView显示建议时输入任何文字 [英] Android: AutoCompleteTextView show suggestions when no text entered
问题描述
我使用AutoCompleteTextView,当用户点击它,我想说明的建议,即使它没有文字 - 但setThreshold(0)的作品完全一样setThreshold(1) - 因此,用户必须输入至少1字符显示的建议。
I am using AutoCompleteTextView , when 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.
推荐答案
这是<一个href="http://developer.android.com/intl/de/reference/android/widget/AutoCompleteTextView.html#setThreshold%28int%29">documented行为的:当阈值小于或等于0,1的阈值被施加
This is documented behavior: "When threshold is less than or equals 0, a threshold of 1 is applied.".
您可以手动表明通过 showDropDown下拉()
,所以也许你可以安排,以显示它时,你想要的。或者,子类 AutoCompleteTextView
和覆盖 enoughToFilter()
,返回真
所有时间。
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.
这篇关于安卓:AutoCompleteTextView显示建议时输入任何文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!