【发布时间】:2016-12-11 18:10:21
【问题描述】:
setonclicklistener 不起作用我如何选择此复选框
public void startQuizClick(View v) {
count++;
HashMap<String, String> h1 = questionlist.get(k);
question.setText(h1.get("question_text"));
val = Integer.parseInt(h1.get("total_options"));
for (int i = 0; i < Integer.parseInt(h1.get("total_options")); i++)
{
HashMap<String, String> h2 = optionlist.get(i);
// cb is custom checkbox
cb = new CheckBox(this);
cb.setId(i);
cb.setEnabled(true);
cb.setTextColor(getResources().getColor(R.color.textColor));
cb.setText(h2.get("option_text" + i));
cb.setTextSize(14);
//linear layout
linearLay1.addView(cb);
}
【问题讨论】:
-
你试过 setOnCheckedChangeListener();
-
尝试使用 setOnCheckedChangedListener。
-
我试试这个也行不通:(
标签: java android android-layout listview android-studio