2011-06-05 60 views
0

模拟器不断崩溃,当我运行这个如何在相对布局中嵌套布局或创建两个相对布局?

<?xml version="1.0" encoding="utf-8"?> 

<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:padding="10px" 
android:background="@drawable/words_background"> 
<ImageView 
    android:layout_height="wrap_content" 
    android:id="@+id/imageView1" 
    android:src="@drawable/logo" 
    android:paddingTop="5dp" 
    android:layout_width="wrap_content" 
    android:layout_alignParentTop="true" /> 
<TextView 
    android:layout_height="wrap_content" 
    android:gravity="right" 
    android:textSize="20dp" 
    android:layout_width="wrap_content" 
    android:id="@+id/lettersQuestion" 
    android:paddingLeft="5dp" 
    android:typeface="normal" 
    android:text="@string/question" 
    android:textStyle="bold" 
    android:layout_below="@+id/imageView1" 
    android:layout_alignRight="@+id/imageView1"></TextView> 
<TextView 
    android:layout_height="wrap_content" 
    android:gravity="right" 
    android:textSize="20dp" 
    android:layout_width="wrap_content" 
    android:id="@+id/board_lettersQuestion" 
    android:paddingLeft="5dp" 
    android:typeface="normal" 
    android:text="@string/question" 
    android:textStyle="bold" 
    android:layout_below="@+id/lettersQuestion" 
    android:layout_alignLeft="@+id/lettersQuestion" 
    android:layout_alignRight="@+id/lettersQuestion" 
    android:paddingTop="20dp"></TextView> 
<EditText 
    android:id="@+id/letters" 
    android:layout_height="wrap_content" 
    android:layout_width="280dp" 
    android:hint="@string/enter_letters" 
    android:layout_below="@+id/imageView1" /> 
<EditText 
    android:id="@+id/board_letters" 
    android:layout_height="wrap_content" 
    android:layout_width="280dp" 
    android:hint="Enter Board Letters" 
    android:layout_below="@+id/letters" /> 
<TextView 
    android:id="@+id/moreText" 
    android:text="@string/more" 
    android:layout_alignLeft="@id/board_letters" 
    android:layout_below="@id/board_letters" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:textSize="15dp" 
    android:typeface="normal" 
    android:paddingLeft="5dp" 
    android:textStyle="bold" /> 
<View 
    android:background="#eee9e9" 
    android:layout_width="fill_parent" 
    android:layout_height="2dp" 
    android:layout_centerVertical="true" 
    android:layout_below="@id/moreText" 
    android:paddingTop="3dp" /> 
<LinearLayout 
    android:id="@+id/moreContent" 
    android:visibility="gone"> 
<EditText 
    android:layout_below="@+id/moreText" 
    android:id="@+id/containsText" 
    android:hint="Contains" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignLeft="@+id/moreText" 
    android:layout_alignRight="@+id/moreText" 
    android:paddingTop="5dp"></EditText> 

<Spinner 
    android:id="@+id/starts_with" 
    android:entries="@array/alphabet_start" 
    android:layout_width="155dp" 
    android:hint="Starts With" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/editText1" 
    android:layout_alignLeft="@+id/editText1" 
    android:prompt="@string/starts_with"></Spinner> 
<Spinner 
    android:id="@+id/ends_with" 
    android:entries="@array/alphabet_end" 
    android:layout_width="155dp" 
    android:prompt="@string/ends_with" 
    android:layout_height="wrap_content" 
    android:layout_toRightOf="@+id/starts_with" 
    android:layout_alignTop="@+id/starts_with" 
    android:layout_alignBottom="@+id/starts_with"></Spinner> 
<Spinner 
    android:id="@+id/minSpinner" 
    android:entries="@array/lengths_min" 
    android:layout_width="80dp" 
    android:prompt="@string/min_length" 
    android:layout_height="wrap_content" 
    android:layout_below="@id/starts_with" 
    android:layout_alignLeft="@+id/starts_with" 
    android:layout_alignRight="@+id/starts_with"> 
</Spinner> 
<Spinner 
    android:id="@+id/maxSpinner" 
    android:entries="@array/lengths_max" 
    android:layout_width="80dp" 
    android:prompt="@string/max_length" 
    android:layout_height="wrap_content" 
    android:layout_below="@id/ends_with" 
    android:layout_alignLeft="@id/ends_with" 
    android:layout_alignRight="@id/ends_with"></Spinner> 
</LinearLayout> 
</RelativeLayout> 

,如果我拿出的LinearLayout能有人帮我格式化才能正常运行工作正常。提前致谢。

+0

当我说拿出线性布局我的意思是只是标签不是内容 – 2011-06-05 17:35:51

回答

1

尝试将默认的android:layout_width,android:layout_heightandroid:orientation添加到您的LinearLayout

编辑:另外,将一个ID添加到LinearLayout上方的视图。

+0

非常感谢它的工作! – 2011-06-05 17:54:20