Is there a way to stay on the same Chip when I press it?

enter image description here

Hello

I am using a Chips in ChipGroup and Chips style theme is Choice

If Choice Chip is clicked, Chip state is change. (background color, etc..)

And you click it again, it will return to its original state.

What I want is that the checked state does not change when I click the same chip.

But i check another Chip in the checked state, the state of the previous chip must return to its

original state.

Are there any properties that support this feature?

In other words, is there a property that keeps the checked check in its state even if it is still

selected?

tried in java code but failed.

Answer

In other words, is there a property that keeps the checked check in its state even if it is still

selected?

Use Chip Choice then add the chips inside ChipGroup.

Add this line to your ChipGroup

<com.google.android.material.chip.ChipGroup
app:singleSelection="true"
app:selectionRequired="true"
app:checkedChip="@id/..."
..>

Then in your Chip

<android.support.design.chip.Chip
android:id="@+id/chip1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checkable="true"
android:checked="true"
app:chipBackgroundColor="@color/bg_chip_state_list"
app:chipText="Test1" />

<android.support.design.chip.Chip
android:id="@+id/chip2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checkable="true"
app:chipBackgroundColor="@color/bg_chip_state_list"
app:chipText="Test2" />

The key is the ChipGroup that has required selection