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.
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.
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?
Thanks.
I think we can build our own chips view with Recycler view and Edit text or Auto complete text view. So we can customize it easily.
1. Created a tag shape say, tags_layout.xml in Drawable
2. Created a layout for recycler view
3. In our activity layout, we implement widgets recycler view just above edit text to keeping tags and edit text or Autocomplete text view to enter tags.
4. Created a model java class for recycler view
5. Adapter class for recycler view
6. Finally, In our activity, add data to recycler on entering data in edit text
7. Manifest file should contain gradles
Starting from android support library version 28.0.0 Google added
Chip
view that allows us to display a chip view within our layout. Design and documentation about ChipAnd simple example:
The official Chips library from Google (as used in Gmail, Email, Calendar, Messaging) is located at https://android.googlesource.com/platform/frameworks/opt/chips/
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
A lot has changed. we have new libraries. I would recommend this library. It is very easy and powerful.
Simply add this dependency
and this view
and this adapter:
there is a new library for Android Material Chips!
Update:
Official way of doing it is now through Chips material component.
https://material.io/components/chips/
https://material.io/develop/android/components/chip/
https://medium.com/material-design-in-action/chips-material-components-for-android-46001664a40f
Old Answer:
You are looking for Chips library.
Here is one https://github.com/kpbird/chips-edittext-library
Another library that works with contacts by Roman Nurik https://plus.google.com/+RomanNurik/posts/WUd7GrfZfiZ