MultiAutoCompleteTextView 和 AutoCompleteTextView 之间的区别
有人可以解释 MultiAutoCompleteTextView
和 AutoCompleteTextView
之间的区别吗?
Can someone explain the difference between MultiAutoCompleteTextView
and AutoCompleteTextView
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
AutocompleteTextView
仅提供有关整个句子的建议,而MultiAutoCompleteTextView
则为句子中的每个标记提供建议。您可以指定标记之间的分隔符。and:
在这个例子中,建议出现在每个逗号之后。
AutocompleteTextView
only offers suggestions about the whole sentence andMultiAutoCompleteTextView
offers suggestions for every token in the sentence. You can specify what is the delimiter between tokens.and:
with this example the suggestion comes after every comma.
使用 AutoCompleteTextView 或 MultiAutoCompleteTextView 之间的选择取决于是否应允许用户仅输入适配器提供的“一项”或“多项”。
例如,如果您正在编写一个电子邮件应用程序,并且您希望“收件人:”字段成为自动完成字段,从地址簿中提取匹配项,那么您很可能希望允许用户为一条消息选择多个收件人,并使该字段成为 MultiAutoCompleteTextView。
另一方面,在同一示例电子邮件应用程序中的“发件人:”字段中,您只需强制用户从其配置的电子邮件帐户中进行一次选择。因此 AutoCompleteTextView 在这里比较合适。
The choice between using the AutoCompleteTextView or the MultiAutoCompleteTextView comes down to whether or not the user should be allowed to input only "one item" as provided by the adapter, or "multiple items."
So for example, if you were writing an email app, and you wanted the "To:" field to be an autocomplete field, pulling matches from an address book, chances are you want to allow the user to pick multiple recipients for a message, and would make this field a MultiAutoCompleteTextView.
On the other hand, the "From:" field in the same example email app, you would need to enforce only a single selection by the user from their configured email accounts. And so an AutoCompleteTextView would be appropriate here.
AutoCompleteTextView 和 MultiAutoCompleteTextView 的区别
AutoCompleteTextView 与 MultiAutoCompleteTextView
AutocompleteTextView 仅提供有关整个句子的建议 MultiAutoCompleteTextView 提供有关以下内容的建议句子中的每个标记。您可以指定标记之间的分隔符。
AutoCompleteTextView 用于选择单个项目 MultiAutoCompleteTextView 用于通过在项目之间使用分隔符(例如逗号)来选择多个项目。
在电子邮件应用程序示例中的“发件人:”字段中,您只需要强制用户从其配置的电子邮件帐户中进行一次选择。如果您正在编写一个电子邮件应用程序,并且希望“收件人:”字段成为自动完成字段,从地址簿中获取匹配项,那么您可能希望允许用户为一条消息选择多个收件人,并且会将该字段设置为MultiAutoCompleteTextView
Difference between AutoCompleteTextView and MultiAutoCompleteTextView
AutoCompleteTextView Vs MultiAutoCompleteTextView
AutocompleteTextView only offers suggestions about the whole sentence MultiAutoCompleteTextView offers suggestions for every token in the sentence. You can specify what is the delimiter between tokens.
AutoCompleteTextView is used for selecting single Item MultiAutoCompleteTextView is used for for selecting multiple Items by using a delimiter(such as comma) in betwwen them.
the “From:” field in example of email app, you would need to enforce only a single selection by the user from their configured email accounts. If you were writing an email app, and you wanted the “To:” field to be an autocomplete field, getting matches from an address book, chances you want to allow the user to pick multiple recipients for a message, and would make this field a MultiAutoCompleteTextView
AutocompleteTextView
仅提供有关整体的建议句子
MultiAutoCompleteTextView
为中的每个标记提供建议句子。
您可以指定标记之间的分隔符,也可以设置第一个或任意一个。 Android 中使用
setThreshold()
和MultiAutoCompeleteTextView
控件的字符数。AutocompleteTextView
only offers suggestions about the wholesentence
MultiAutoCompleteTextView
offers suggestions for every token in thesentence.
You can specify what is the delimiter between tokens also set the first or any no. of characters using
setThreshold()
withMultiAutoCompeleteTextView
control in Android.