tags:

views:

273

answers:

0

I have a simple android application, but when I try to implement a scrollview in the xml of the layout the application force closes each time I try to run it on the emulator.

Here is the xml:

<?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">
     <ScrollView
        android:id="@+id/egyptianScroll"
        android:orientation="vertical" 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
     <TableLayout 
        android:id="@+id/egyptianTable"
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:stretchColumns="*"
        android:background="#ff0000">
            <TableRow>
                <TextView android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="Product"
                        android:background="#00ff00" android:layout_margin="2dip" />
                <TextView android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="x"
                        android:background="#00ff00" android:layout_margin="2dip" />
                <TextView android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="y"
                        android:background="#00ff00" android:layout_margin="2dip" />
            </TableRow>
    </TableLayout>
    </ScrollView>
    <TextView  android:id="@+id/result"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text=""/>
        <LinearLayout android:orientation="horizontal"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content">

     <TextView android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="x:" />
     <EditText android:id="@+id/x"
                        android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_weight="1"
                        android:numeric="integer"/>
                <TextView android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="y:" />
                <EditText android:id="@+id/y"
                        android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_weight="1"
                        android:numeric="integer"/>

    </LinearLayout>
        <LinearLayout android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
                <Button android:id="@+id/multiplication"
                        android:text="Multiply"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />
                <Button android:id="@+id/powers"
                        android:text="Powers"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />
        </LinearLayout>
</LinearLayout>

Edit: I moved the ScrollView to encapsulate the other views and it worked fine, it cannot be put inside other views?