【发布时间】:2017-10-09 20:56:45
【问题描述】:
我在 Java 中使用复选框时遇到问题。无论复选框是否被选中,结果始终为是。有人可以帮我检查一下下面的代码是否有任何错误吗?
private String whippedCreamMethod(){
CheckBox checkBoxWhippedCream = (CheckBox) findViewById(R.id.whipped_cream_checkbox);
if (checkBoxWhippedCream.isSelected()){
whippedCream = "No";
} else {
whippedCream = "Yes";
}
return whippedCream;
}
【问题讨论】:
-
看这个帖子:checkbox java