siraj
siraj

Reputation: 461

Android-errors in scroll view

I am using a layout with Scroll View. But in Logcat I got this error: "java.lang.IllegalStateException: ScrollView can host only one direct child"..Why?? Here Scroll view has only one child ie;LinearLayout...

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

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="#F2F2F2"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/taskName"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:textColor="#000000"
            android:textSize="30dip" >
        </TextView>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Status: "
                android:textColor="#000000"
                android:textSize="20dip" >
            </TextView>

            <TextView
                android:id="@+id/taskStatus"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#000000"
                android:textSize="20dip" >
            </TextView>

            <TextView
                android:id="@+id/taskTime"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#000000"
                android:textSize="20dip" >
            </TextView>
        </LinearLayout>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Completion notes:  "
            android:textColor="#000000"
            android:textSize="18dip" >
        </TextView>

        <TextView
            android:id="@+id/taskCompleteStatus"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:maxLines="10"
            android:textColor="#000000"
            android:textSize="15dip" >
        </TextView>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Cancellation notes:  "
            android:textColor="#000000"
            android:textSize="18dip" >
        </TextView>

        <TextView
            android:id="@+id/taskCancelStatus"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#000000"
            android:textSize="15dip" >
        </TextView>
    </LinearLayout>

</ScrollView>

Thanks in advance!!!

Upvotes: 0

Views: 589

Answers (1)

tomato
tomato

Reputation: 3383

Try cleaning your project and doing a full rebuild. I've experienced odd behaviour like this in the past where resources seem to misbehave after a few changes.

Upvotes: 3

Related Questions