ultiAutoCompleteTextView和AutoCom

ultiAutoCompleteTextView和AutoCom

本文介绍了MultiAutoCompleteTextView和AutoCompleteTextView之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以解释MultiAutoCompleteTextViewAutoCompleteTextView之间的区别吗?

Can someone explain the difference between MultiAutoCompleteTextView and AutoCompleteTextView?

推荐答案

AutocompleteTextView仅提供有关整个句子的建议,而MultiAutoCompleteTextView提供有关句子中每个标记的建议.您可以指定标记之间的分隔符.

AutocompleteTextView only offers suggestions about the whole sentence and MultiAutoCompleteTextView offers suggestions for every token in the sentence. You can specify what is the delimiter between tokens.

String[] words=new String[] {
     "word1", "word2", "word3", "word4", "word5"
 };

MultiAutoCompleteTextView macTv = (MultiAutoCompleteTextView) this.findViewById(R.id.mac_tv);
ArrayAdapter<String> aaStr = new ArrayAdapter<String>(this,android.R.layout.dropdown_item,words);
macTv.setAdapter(aaStr);
macTv.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer() );


和:


and:

<MultiAutoCompleteTextView
android:id="@+id/mac_tv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
/>

在此示例中,建议是在每个逗号之后出现的.

with this example the suggestion comes after every comma.

这篇关于MultiAutoCompleteTextView和AutoCompleteTextView之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 17:37