Material-components-android: [Chip] Why do you prevent developers from setting the gravity on chips?

Created on 30 Sep 2019  路  2Comments  路  Source: material-components/material-components-android

I want to use Chips with Choice style working like RadioButton. For example, I put 4 chips in a LinearLayout horizontally and set each of their width as the quarter of the screen. I wanted to set text gravity as center but you give a log with this message:

Chip text must be vertically center and start aligned

I figured out that you prevented developers from setting the gravity on chips in this commit:
Prevent users from setting the gravity on chips, chip text must be vertically center and start aligned.

My opinion is that this prevention is too much for us. This also decreases the usage rate of this component. Chip would be a great competitor against SegmentedControl in iOS.

All 2 comments

Hi @egemenhamutcu

Thank you for the question. This is intentional to comply with spec guidance. For a component similar to SegmentedControl in iOS, please try MaterialButtonToggleGroup

I don't think it's easy to set the gravity of the chip. It's not scalable at all. I want to center the text.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gabrielemariotti picture gabrielemariotti  路  3Comments

ataulm picture ataulm  路  3Comments

ahmaducg picture ahmaducg  路  3Comments

TdevM picture TdevM  路  3Comments

KelvinPac picture KelvinPac  路  3Comments