android - Put radio buttons in group -
i have 4 different radio buttons want set in 2 different group. problem not want set buttons vertically or horizontally. putting them randomly on layout.
now how can apply grouping on each button?
try this:
radiogroup radiogroup1 = new radiogroup(context); radiogroup radiogroup2 = new radiogroup(context); radiobutton radiobtn1 = new radiobutton(context); radiobutton radiobtn2 = new radiobutton(context); radiobutton radiobtn3 = new radiobutton(context); radiobutton radiobtn4 = new radiobutton(context); radiogroup1.addview(radiobtn1); radiogroup1.addview(radiobtn2); radiogroup2.addview(radiobtn3); radiogroup2.addview(radiobtn4);
android radio-button radio-group
No comments:
Post a Comment