RadioGroup里面的怎么有两个RadioButton被选中了

2024-11-21 20:47:11
推荐回答(1个)
回答1:

rLayout.setLayoutParams(new LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,LinearLayout.LayoutParams.FILL_PARENT));

linearLayout.setOrientation(LinearLayout.VERTICAL);

for(int i=0;i<3;i++){

textView = new TextView(this);

textView.setText(i+"你喜欢谁?");

linearLayout.addView(textView);

radioGroup = new RadioGroup(this);

radioGroup.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT));

radioGroup.setId(i);

for(int j=0;j<2;j++){

radioButton = new RadioBut