在Android中,如何更改自动完成功能,使其在单个字符后而不是2个字符后启动?

pun*_*etk 2 android

我尝试在Android中自动完成,但是它面临着一个特殊的问题.自动填充仅在您输入2个字符后显示建议,而不是在单个字符后输出.那是怎么回事?

如何更改自动完成功能,使其在单个字符后而不是2个字符后启动?

luk*_*uku 6

通过在xml中设置阈值(android:completionThreshold).例如:

 <AutoCompleteTextView android:id="@+id/edit"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:completionThreshold="1"/>
Run Code Online (Sandbox Code Playgroud)

或通过调用setThreshold()方法以编程方式