我有一些 RadioButtons,我希望在模型更改时使用数据绑定选中/取消选中它们。
我设法设置了一个 EditText 并且它工作正常。
无论如何, RadioButtons 的行为就像 android:checked 属性不存在一样。
<RadioButton
android:id="@+id/radio_kitchen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/kitchen"
android:checked="@{radiator.room==@string/kitchen?true:false}"
/>
Run Code Online (Sandbox Code Playgroud)