RadioGroup does not appear ?

Posted by Mina Samy on Stack Overflow See other posts from Stack Overflow or by Mina Samy
Published on 2010-04-08T20:54:17Z Indexed on 2010/04/08 21:23 UTC
Read the original article Hit count: 430

Filed under:

Hi all

I have a linear layout with this form

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<RadioGroup android:id="@+id/group"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<RadioButton android:id="@+id/item1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item1"
android:checked="true" />
<RadioButton android:id="@+id/item2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item2" />


<RadioButton android:id="@+id/item3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item3" />
</RadioGroup>

 <TextView
    android:id="@+id/txt"
    android:layout_width="fill_parent"
android:layout_height="fill_parent"
    />
</LinearLayout>

this works fine but if I put the TextView above the RadioGroup like this

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

<TextView
    android:id="@+id/txt"
    android:layout_width="fill_parent"
android:layout_height="fill_parent"
    />
   <RadioGroup
   android:id="@+id/group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

>
<RadioButton android:id="@+id/item1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item1"
android:checked="true"
 />
<RadioButton android:id="@+id/item2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item2" />
<RadioButton android:id="@+id/item3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item3" />
</RadioGroup>
</LinearLayout>

the activity appears blank

what can be the reason for this

thanks

© Stack Overflow or respective owner

Related posts about android