Reputation: 1837
I want a row in my layout with
radioButton, edit text, textview
surrounded by a radioGroup. However the radioGroup does't seem to work this way. I'm generating this layout with code not xml, just to show how it would look like:
<ScrollView>
<LinearLayout>
<RadioGroup>
<RelativeLayout>
<RadioButton>
<EditText>
<TextView>
</RelativeLayout>
<RelativeLayout>
<RadioButton>
<EditText>
<TextView>
</RelativeLayout>
</RadioGroup>
</LinearLayout>
</ScrollView>
I can select all radiobuttons, the group is not working. what is wrong, or how would I solve this problem?
Upvotes: 0
Views: 49
Reputation: 355
You can't have RelativeLayouts in a RadioGroup. The view will actually be rendered as expected, but the radio buttons won't function (they will lose their grouping). If you need an EditText inside each button, you'll have to code the radio button functionality yourself. However, if you just need different text styles inside the radio button, look at SpannableString.
Upvotes: 1