Search code examples
androidandroid-layoutandroid-linearlayoutandroid-radiogroupandroid-radiobutton

Why is my RadioGroup so large yet devoid of contents/RadioButtons?


Here is the portion of XML that I have in my Android Layout file that should generate a RadioGroup with three RadioButtons inside:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <RadioGroup
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <RadioButton
            android:id="@+id/radbtnAlways"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:checked="true"
            android:text="@string/radiobutton_Always" />

        <RadioButton
            android:id="@+id/radbtnNever"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/radiobutton_Never" />

        <RadioButton
            android:id="@+id/radbtnCost_Change"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/radiobutton_Cost_Change" />

    </RadioGroup>
</LinearLayout>

However, all I see where these widgets should be is a bluish outline of what appears to be the state of Colorado - it is too large, and displays no RadioButtons:

enter image description here

Why is my RadioGroup so large, and why do the RadioButtons do a George Jones imitation?

UPDATE

In answer to CommonsWare, here's what it looks like in the Emulator (pretty much the same):

enter image description here


Solution

  • Remove these two properties from all the RadioButtons:

    android:layout_width="0dip"
    android:layout_weight="1"
    

    So it now looks better:

    enter image description here