Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

show radio buttons on one line?

Tags:

android

I can't understand why my radio buttons aren't on one line, I've pasted my code so far below - I know it's not the same as the tutorial, but I'm really trying to understand every line, so want to know what the equivalent to 'float' is in android - tried playing with gravity, weight etc, but didn't seem to put them onto one line..

Many thanks in advance!

<RadioGroup 
android:id="@+id/RadioGroup01" 
android:layout_height="wrap_content" 
android:layout_width="wrap_content"
android:layout_column="0"
android:layout_span="3">

    <RadioButton 
        android:id="@+id/RadioButton01" 
        android:layout_height="wrap_content" 
        android:freezesText="true" 
        android:textSize="10sp" 
        android:text="15%" android:layout_width="wrap_content">
    </RadioButton>

<RadioButton android:id="@+id/RadioButton02" android:layout_height="wrap_content" android:text="20%" android:textSize="10sp" android:layout_width="wrap_content">

like image 709
Alphatester77 Avatar asked Dec 04 '10 23:12

Alphatester77


People also ask

How do I display radio buttons horizontally?

To make a horizontal radio button set, add the data-type="horizontal" to the fieldset . The framework will float the labels so they sit side-by-side on a line, hide the radio button icons and only round the left and right edges of the group.

How do you group radio buttons together?

You group radio buttons by drawing them inside a container such as a Panel control, a GroupBox control, or a form. All radio buttons that are added directly to a form become one group. To add separate groups, you must place them inside panels or group boxes.

Can radio buttons be multi select?

Radio buttons allow a user to select a single option among multiple options. You can set the Choice Value of each option, for each button, as well as group these buttons by giving them the same Group Name.


1 Answers

Add android:orientation="horizontal" to RadioGroup (see line 61 of the main.xml example from the tutorial in the link you posted).

like image 57
Squonk Avatar answered Oct 01 '22 10:10

Squonk