Closed YogevUzan closed 6 years ago
For example, add the folowing bg_unchecked.xml
to /res/drawable
:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#cfd8dc"/>
<size
android:width="36dp"
android:height="36dp"/>
</shape>
Then add bg_unchecked.xml
to the button as background:
<com.nex3z.togglebuttongroup.SingleSelectToggleGroup
android:id="@+id/group_choices"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tbgCheckedButton="@+id/choice_a">
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="@+id/choice_a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:background="@drawable/bg_unchecked"
android:text="A"/>
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="@+id/choice_b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:background="@drawable/bg_unchecked"
android:text="B"/>
<!--...-->
</com.nex3z.togglebuttongroup.SingleSelectToggleGroup>
The button will have a background for the unchecked state:
checked
attribute? If it's meant to set the button's default checked state, it may cause checked state collision in SingleSelectToggleGroup
, as you can set two button to be checked by default where SingleSelectToggleGroup
only allows one. I'm afraid I won't add this attribute to the built in button for simplicity as they are only samples for implementing custom buttons. You can always set button's checked state programmatically, or implement your own custom button with this attribute.
Hi, can you please add these attributes ( XML )?