user2472522 user2472522 - 1 month ago 9
Android Question

Issue with android studio and radiogroup

I'm trying to make a simple app in android studio but running into trouble with layout whenever I place down a

RadioGroup
. In my first image here I've created a
RadioGroup
and dragged two
RadioButtons
into it by dragging them to the radiogroup option on the component tree trying to drop them into the radiogroup on the layout thing is impossible as the radiogroup is completely invisible on it.

enter image description here

I drag a button below it, lining it up with the center, and the box that shows where the buttons going to go shows it being below the radiogroup. But once I release the mouse button, the button im attempting to place ends up here.

enter image description here

I've been fighting with android studio for a while now but if I get the button even remotely close to the
RadioGroup
it gets catapulted up the screen, and I don't have enough room if I place the button way down low for my other elements.

tl;dr
radiogroups are catapulting any elements underneath them above them. its probably a layout or gravity issue or something like that. but I don't know how to fix it and would like my buttons to not be underneath all the other elements kthx.

Answer

I'm not sure what is causing your issue, because you aren't providing enough information. But If you want the button to appear under your radio group, then in your xml file, give your radio group an id android:id="@+id/radioGroup" and in your button add android:layout_below="@id/radioGroup".

Comments