public void onCheckboxClicked(View view) {
// Is the view now checked?
boolean checked = ((CheckBox) view).isChecked();
// Check which checkbox was clicked
switch(view.getId()) {
// code here
}
我在android studio中编写此代码,它给了我错误,“无法解析符号'视图'。”我已经导入了android.view.View,但这不是解决我的问题。任何帮助,将不胜感激。 提前谢谢!
答案 0 :(得分:0)
你应该摆脱不必要的分号,正确的代码应该是
public void onCheckboxClicked(View view) {
// Is the view now checked?
boolean checked = ((CheckBox) view).isChecked();
// Check which checkbox was clicked
switch(view.getId()) {
答案 1 :(得分:0)
在onCheckboxClicked
之后和view
public void onCheckboxClicked(View view){
//...
}