1、改变选择框:以RadioButton为例
2、选中状态判断
CheckBox:
cb.setId(i);
cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
listAnswer.getAnswer().get(compoundButton.getId()).setSelect(isChecked);
}
});
RadioButton:
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int checkId) {
listAnswer.getAnswer().get(checkId).setSelect(true);
if(ActivityUtils.isActivityExist(QuestionActivity.class)){
ActivityUtils.getActivity(QuestionActivity.class).setQuestionListBean(number,listAnswer);
}
}
});
最好用CheckBox cb = UIUtils.inflate(context,R.layout.check_question).findViewById(R.id.cb_answer)方式引用;