0

我有这个代码:

if(ratingRB.isChecked() == true)
{
    Toast.makeText(hotelSearch.this, "Please enter the rating as a word. (Ex. Five)", Toast.LENGTH_SHORT).show();
}
else
{
    if(showAllRB.isChecked() == true)
    {
       nearest.setEnabled(true);
    }
}

但是当我检查 2 个单选按钮(ratingRB、showAllRB)中的任何一个时,什么都没有发生。

nearest是一个从一开始就被禁用的复选框,我希望当用户选择时showAllRB,复选框被启用..怎么了?我该怎么办?

4

1 回答 1

0

这是一个类似的问题:Radio Button selection Changes Toast on Android

您想将您添加RadioButtons到 a 中RadioGroup,然后实现 a RadioGroup.setOnCheckedChangeListener()

于 2012-06-23T00:52:34.763 回答