ADD RADIO BUTTON ;
//Horizontal
final RadioButton[] rb = new RadioButton[5];
final RadioButton[] gg = new RadioButton[5];
RadioGroup rg = new RadioGroup(this);
//create the RadioGroup
rg.setOrientation(RadioGroup.HORIZONTAL);
for(int i=0; i<1; i++){
rb[i] = new RadioButton(this);
rb[i].setText("Correct!");
rb[i].setId(1);
gg[i] = new RadioButton(this);
gg[i].setText("Wrong!");
gg[i].setId(2);
rg.addView(rb[i]);
rg.addView(gg[i]);
linear1.addView(rg);
}
// Vertical
final RadioButton[] rb = new RadioButton[5];
final RadioButton[] gg = new RadioButton[5];
RadioGroup rg = new RadioGroup(this);
//create the RadioGroup
rg.setOrientation(RadioGroup.VERTICAL);
for(int i=0; i<1; i++){
rb[i] = new RadioButton(this);
rb[i].setText("Correct!");
rb[i].setId(1);
gg[i] = new RadioButton(this);
gg[i].setText("Wrong!");
gg[i].setId(2);
rg.addView(rb[i]);
rg.addView(gg[i]);
linear1.addView(rg);
}
0 Comments: