我正在互联网上搜索如何通过RadioGroup执行新的酷

Android数据绑定,我没有找到关于它的单一博客文章.

它是一个简单的场景,基于所选的单选按钮,我想使用android数据绑定附加一个回调事件.我没有在xml部分找到允许我定义回调的任何方法.

就像这里是我的RadioGroup:

android:id="@+id/split_type_radio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:checkedButton="@+id/split_type_equal"
android:gravity="center"
android:orientation="horizontal">
...

如何附加将在RadioGroup上调用的处理程序方法,checkChnged事件将使用数据绑定触发?

我已尝试在布局文件中使用onClick(不知道它是否相同)并在Activity中定义方法并在布局文件中使用它来定位它:

name="handler"
type="com.example.MainActivity"/>
...
android:onClick="handler.onCustomCheckChanged"
.. >

和定义方法onCustomCheckChanged如下:

public void onCustomCheckChanged(RadioGroup radio, int id) {
// ...
}

但是,它给了我编译错误:

Error:(58, 36) Listener class android.view.View.OnClickListener with method onClick did not match signature of any method handler.onCustomCheckChanged

我看过许多博客提到它可能与RadioGroup有关,但他们没有真正说出如何.如何通过数据绑定处理此问题?