So I have the following radiobuttons. I want to have them display like this:
However this occurs:
How I can get it to display like above?
I can move in the GUI editor in Eclipse it but it removes the RadioButton from the RadioGroup!
Within the group, it ignores all other layout parameters.
<RadioGroup
android:id="@+id/radioGroup1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/timeBar"
android:layout_marginTop="43dp"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/privRadio0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Everyone" />
<RadioButton
android:id="@+id/privRadio1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="FriendOfFriends" />
<RadioButton
android:id="@+id/privRadio2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Friends" />
</RadioGroup>
You can simply copy this class:
https://github.com/jevonbeck/AbstractMachine/blob/jevon_dev/app/src/main/java/org/ricts/abstractmachine/ui/utils/MultiLineRadioGroup.java
into an appropriate package in your project and instantiate in XML like so:
<view
class="mypackage.packagepath.MultiLineRadioGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"/>
What you are asking for is a FlowLayout. Such a layout has the benefit of only wrapping when it's needed, as opposed to 0gravity's more "static" solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With