1

enter image description here

How can I implement Android Material Design chips without an external library. Google Apps have it inside their apps, so I guess that it should be available in the native SDK. If yes, how to implement it for a contacts selection functionality. Similar to the given screenshot.

LEE
  • 3,335
  • 8
  • 40
  • 70

1 Answers1

0

Google has officially released a library for it you can use that:

dependencies {
    implementation 'com.google.android.material:material:1.0.0'
}

Then you just need to add it in XML, like this :

<chip
style="@style/Widget.MaterialComponents.Chip.Entry"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:checkable="false"
app:chipIcon="@drawable/ic_android_24dp"
app:iconStartPadding="5dp"/>

Or you can add it dynamically as stated here: Stack Overflow Answer

Taken from Chips Example here. More info about chips is also stated here.

KnowIT
  • 2,392
  • 1
  • 18
  • 16