alionSSS
【原因】setOnCheckedChangeListener()是CheckBox的方法,不是View的方法。我说下该怎么修改,看代码:private View checkBox;//此处View应该改为CheckBox【示例】private CheckBox checkBox;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
checkBox = (CheckBox)findViewById(R.id.check_box);
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
}
});
}