MarshallLee
MarshallLee

Reputation: 1330

Android: Do Google not provide the APIs for chips?

I am now trying to use chips UI, so I started looking for the APIs. But it seems like there are no such APIs for the chips in Android basically provided by Google even though there is an introduction to the UI components of material design chips on the website (https://www.google.com/design/spec/components/chips.html).

So instead it seems like I have to use third party libraries like https://github.com/klinker41/android-chips. But before that I just want to find out if this will be the only option to use chips.

Upvotes: 1

Views: 874

Answers (2)

Psypher
Psypher

Reputation: 10829

Posting an updated answer since its part of google design library.

Chip is a rounded button that consists of a label, an optional chip icon, and an optional close icon. A chip can either be clicked or toggled if it is checkable. It extends the AppCompatCheckBox.

These are divided into 3 categories:

  1. Filter chip
  2. Choice chip
  3. Action chip

Now Chip is available as part of android design support library. You can now add a chip as below:

<com.google.android.material.chip.Chip
    style="@style/Widget.MaterialComponents.Chip.Action"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:chipIcon="@drawable/ic_action_24"
    app:chipText="@string/hello_world"/>

More details here in this link

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1006614

But it seems like there are no such APIs for the chips in Android basically provided by Google even though there is an introduction to the UI components of material design chips on the website (https://www.google.com/design/spec/components/chips.html).

Lots of what is described in the Material Design specification is not available directly from Google for Android.

I just want to find out if this will be the only option to use chips

It certainly is your only option today, besides creating a chips-style UI yourself from scratch.

Upvotes: 2

Related Questions