MultiAutoCompleteTextView 和 AutoCompleteTextView 的区别 [英] Difference between MultiAutoCompleteTextView and AutoCompleteTextView

查看:31
本文介绍了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() );

<小时>

和:

<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 的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆