Alphatester77
Alphatester77

Reputation: 702

show radio buttons on one line?

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">

Upvotes: 10

Views: 14727

Answers (2)

Hanco
Hanco

Reputation: 11

Under <RadioGroup try this line android:orientation="horizontal"

Upvotes: 1

Squonk
Squonk

Reputation: 48871

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

Upvotes: 42

Related Questions