我需要实施多项选择题。我必须为多项选择添加单选按钮和文本视图。我需要根据选择的数量动态地实现它。有人能帮我吗
for (Answer answer : answers) {
LinearLayout linearLayoutRw2 = new LinearLayout(this);
linearLayoutRw2
.setLayoutParams(new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT));
RadioGroup radioGroup = new RadioGroup(
ShowQuestionsActivity.this);
linearLayoutRw2.addView(radioGroup);
RadioButton rb = new RadioButton(ShowQuestionsActivity.this);
radioGroup.addView(rb);
TextView ansText = new TextView(ShowQuestionsActivity.this);
ansText.setText(Html.fromHtml(answer.getAnswerText()));
linearLayoutRw2.addView(ansText);
linearLayoutShowQues.addView(linearLayoutRw2);
}