
how to create android Multi Auto-Complete Text-View with chips

how to create android Multi Auto-Complete Text-View with chips
I created a simple library for this purpose : https://github.com/Plumillon/ChipView
Here a quickstart :
Add ChipView to your layout or create it programmatically :
<com.plumillonforge.android.chipview.ChipView
android:id="@+id/chipview"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
Init it with a list of data which extend Chip interface and add a click listener (if you want) :
List<Chip> chipList = new ArrayList<>();
chipList.add(new Tag("Lorem"));
chipList.add(new Tag("Ipsum dolor"));
chipList.add(new Tag("Sit amet"));
chipList.add(new Tag("Consectetur"));
chipList.add(new Tag("adipiscing elit"));
ChipView chipDefault = (ChipView) findViewById(R.id.chipview);
chipDefault.setChipList(chipList);
chipDefault.setOnChipClickListener(new OnChipClickListener() {
@Override
public void onChipClick(Chip chip) {
// Action here !
}
});
Default ChipView is rendered like this :
But you can customise as you like from overall to Chip level :
This isn't a MultiAutocomplete but you can manage to mimic it (I'm actually using it like that)
Material Design specifications include something called chips, which do what you are asking for. A library is found here.