android – 在没有波纹动画的情况下取消选中Radio Group中的单选按钮

我有一个测验应用程序,它在textview中显示问题,4个答案在一个带4个单选按钮的广播组中.要转到下一个问题,用户必须单击“下一步”按钮.

当用户选择特定的单选按钮并单击“下一步”按钮时,我会使用下一个问题及其答案重新填充我的UI.在显示下一个问题之前,我使用RadioGroup clearCheck()清除单选按钮选择.

但是,用户可以在UI中看到此选择更改.

我尝试将透明色设置为单选按钮背景,但这并没有解决问题.

我该如何解决这个问题?

最佳答案 尝试添加您自己的radiobutton drawable,如下所示:

quiz_radiobutton.xml:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
        <item android:state_checked="false" android:drawable="@drawable/checkbox_outline" />
        <item android:state_checked="true" android:drawable="@drawable/checkbox_outline_checked" />
</selector>

然后,更改按钮中的drawable:

<android.support.v7.widget.AppCompatRadioButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:button="@drawable/quiz_radiobutton"
/>

这将停用纹波动画.

点赞