The emulator keeps on crashing when I run this
<?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_hei开发者_开发百科ght="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>
It works fine If I take out the LinearLayout can someone please help me with formatting it to run properly. Thanks in advance.
Try adding a default android:layout_width
, android:layout_height
, and android:orientation
to your LinearLayout
.
EDIT: Also, add an ID to the View above the LinearLayout.
精彩评论