带有芯片的 Android AutoCompleteTextView

2022-01-14 00:00:00 android java android-edittext

我不确定我是否为这个 UI 功能使用了正确的词,但我附上了我希望在我的应用中实现的目标的快照.

I am not sure I am using the right words for this UI feature, but I have attached a snapshot of what I am looking to achieve in my app.

Go SMS 使用它,用户在编辑文本中键入联系人,在用户从完成下拉列表中选择联系人后,联系人将插入到编辑文本中,如附图所示.编辑文本是仍然开放以接受进一步的输入.

Its used by Go SMS, where a user types contacts in an edit text, after the user selects a contact from the completion drop down, the contact is inserted in the edit text as show in the attached image.The edit text is still open to accept further input.

对于我的应用程序,我想在用户输入逗号后立即进行分组和插入,就像 StackOverflow 的标签输入一样(但我相信我可以单独处理.)我的问题是什么样的查看是这个还是我如何修改 EditText 以使其具有这样的行为?

For my app, I would like to do the grouping and insertion as soon as the user enters a comma, Just like the Tag input for StackOverflow works (But I believe I can handle that alone.) My problem is what kind of View is this or how do I modify an EditText to behave like this?

谢谢.

推荐答案

Google 的官方 Chips 库(用于 Gmail、电子邮件、日历、消息)位于 https://android.googlesource.com/platform/frameworks/opt/chips/

The official Chips library from Google (as used in Gmail, Email, Calendar, Messaging) is located at https://android.googlesource.com/platform/frameworks/opt/chips/

如何使用它的简单示例可以在 https://code.google.com/p/platform-features-talk-io-2013/source/browse/src/com/example/iotalk/ChipsActivity.java

A simple example of how to use it can be found at https://code.google.com/p/platform-features-talk-io-2013/source/browse/src/com/example/iotalk/ChipsActivity.java

相关文章