Questions tagged [android-chips]

Chips are compact elements that represent an input, attribute, or action. Chips allow users to enter information, make selections, filter content, or trigger actions. Chips should appear dynamically as a group of multiple interactive elements. Unlike buttons, which should be a consistent and familiar call to action, one that a user expects to appear as the same action in the same general area.

The Chip android component is provided by the Material Components Library.

A Chip represents a complex entity in a small block, such as a contact. It 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.

Chips may be placed in a ChipGroup, which can be configured to lay out its chips in a single horizontal line or reflowed across multiple lines. If a chip group contains checkable chips, it can also control the multiple-exclusion scope for its set of chips so that checking one chip unchecks all other chips in the group.

192 questions
47
votes
4 answers

Android material chip component crashing app. Unable to inflate xml

Tried Chip component from both support library com.google.android.support:design:28.0.0-rc01 and material com.google.android.material:material:1.0.0-rc01 StackTrace android.view.InflateException: Binary XML file line #72: Binary XML file …
46
votes
8 answers

Set com.google.android.material.chip.Chip selected color

How do I set the selected com.google.android.material.chip.Chip color? I don't want it to be the default gray. This is a single selection chip group. Original documentation here
35
votes
7 answers

ChipGroup single selection

How can I force a ChipGroup to act like a RadioGroup as in having at least one selected item always? Setting setSingleSelection(true) also adds the possibility to have nothing selected if you click twice on a Chip.
34
votes
7 answers

Android how to center align chips in chipgroup?

I tried gravity="center" , foregroundGravity="center" and textAlignment="center" for ChipGroup in the XML file but it won't work. Any ideas?
M_droid
  • 1,120
  • 1
  • 14
  • 24
31
votes
3 answers

Chips component in android support library?

This material design show case says about chips component. But I couldn't find example code of this component? How can I use it? please show me XML code and java code.
Knowledge Drilling
  • 844
  • 1
  • 8
  • 19
30
votes
11 answers

Android Chip Custom Height Or Padding - Chipgroup spacing

Is there a way to change default material Chip vertical padding or height? From the docs I see there surely is a way to set the minimal height, but I would like to make chips "thinner", like in this design:
22
votes
3 answers

Change Chip Widget style programmatically not working - Android

I'm doing a list with Chips. I want this chips can be selected, so, taking a look to https://material.io/develop/android/components/chip/ I see I can have a "Choice Chip". As I need to create and add dynamically I have to configure with specific…
22
votes
5 answers

How to add chips from Material Components library to input field in android?

I've seen that in android-P google add new material components library which contains material chips: Material components for android Material.io chips usage Material components on GitHub So I decided to add material input chips to my project, but…
21
votes
2 answers

How can I add the new android chips dynamically in Android?

I have a class called Question which contains a String array of tags. I'm trying to show every question in a Recyclerview using Kotlin and every tag in a new chip. These chips will be included inside a ChipGroup. My question is: How can I add every…
ramon guardia
  • 335
  • 1
  • 2
  • 9
19
votes
5 answers

Android material chips

I want to implement an autocomplete edittext with chips in my application and I want to do it in a way that it's done here: material design chips. First I would like to ask if there is some kind of widget (maybe as part of the new support library)…
18
votes
7 answers

Chip Group OnCheckedChangeListener() not triggered

I'm trying to make a recyclerview filter based ChipGroup & Chip I'm use fragment on my app, so, the fragment who contain the RecyclerView contain a frameLayout who inflate the ChipGroup filter fragment I'm trying to trigger a listener when the…
Benjamin
  • 361
  • 1
  • 2
  • 15
12
votes
1 answer

Android Chip inflation causes "Invalid ID 0x00000000."

After moving to android-x I noticed that there are plenty of logs saying: "E/itterforandroi: Invalid ID 0x00000000." I manage to circle down to the point where I'm creating a new RecyclerView ViewHolder and inflating a layout that contains a Chip.…
Fiszu
  • 198
  • 1
  • 2
  • 7
12
votes
3 answers

Set border color for a chip in Android

In my android app I have a simple chip that looks like this. Is there any way to set the color of the border to make it like this? UPDATE: I tried to do add the shape but there's an exception during inflating the layout …
10
votes
4 answers

Dynamically create Choice Chip in android

I am using Material Components for creating the Choice chip. I have followed https://material.io/develop/android/components/chip/ document. There is enough stuff for creating a chip in XML but not get an idea of how to create choice chip…
10
votes
4 answers

Set background color of the material chip programmatically

Chip chip = new Chip(context); chip.setBackgroundcolor(getResources().getColor(R.color.blue)); The above line gives the error: java.lang.UnsupportedOperationException: Do not set the background resource; Chip manages its own background drawable.
1
2 3
12 13