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.
Asked
Active
Viewed 1,359 times
1
-
any luck with it? – rookieDeveloper Nov 11 '16 at 05:25
-
@rookieDeveloper not yet! But basically, the concept goes around concatenating strings by a StrinbBuilder and then assign these strings to a textview. Give some style to the textview like padding, round corners,etc. – LEE Nov 11 '16 at 13:41
-
Check out this answer. Should help. http://stackoverflow.com/a/41776777/2254969 – Ankit Aggarwal Jan 21 '17 at 07:25
-
See My Answer and code sample https://stackoverflow.com/a/52007466/5439116 – Sourin Ghosh Aug 24 '18 at 17:13
1 Answers
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