I'm using Chip for checking and unchecking buttons. I have multiple choices and user can check only one of them. The problem is when i'm click on checked button it's getting unchecked but that's not what i'm expecting. I want my button to be checked anyway and it should uncheck only when you check another button. I'm using custom style:
<style name="Widget.MaterialComponents.Chip.Choice" parent="Base.Widget.MaterialComponents.Chip">
<item name="android:checkable">true</item>
<item name="chipIconVisible">false</item>
<item name="closeIconVisible">false</item>
<item name="chipCornerRadius">5dp</item>
<item name="ensureMinTouchTargetSize">false</item>
<item name="chipStrokeWidth">2dp</item>
<item name="chipStrokeColor">@color/chip_state_selector</item>
<item name="checkedIconVisible">false</item>
</style>
And custom borders for it:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:color="@color/black"
android:state_selected="true"
android:state_checked="true"/>
<item
android:color="@color/black"
android:state_selected="true"/>
<item
android:state_selected="false"
android:color="@color/white"/>
</selector>
What i'm expect: 3 buttons. First checked as default. If i press this button again it's not getting uchecked because it's the only one checked button here. When i'm pressing another button this button getting uncheked and the new button getting checked of course.