I want to use DataBinding on the MaterialButtonToggleGroup
with MaterialButton
, however it seems like there is no onButtonChecked
attribute for MaterialButtonToggleGroup
:
<com.google.android.material.button.MaterialButtonToggleGroup
android:id="@+id/majors_toggleGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:onButtonChecked="@{(group, buttonId, isChecked) -> viewModel.recordIndex(group.indexOfChild(group.findViewById(buttonId)))}">
It doesn't compile, shows:
Cannot find a setter for <com.google.android.material.button.MaterialButtonToggleGroup android:onButtonChecked> that accepts parameter type 'lambda'
. Any help? (app: onButtonChecked
doesn' work either)
Seems no luck, I have to manually set
OnButtonCheckedListener()
on them:Single Selection Listening:
Multiple Selection Listening: