【问题标题】:Android-errors in scroll view滚动视图中的 Android 错误
【发布时间】:2011-11-11 10:23:19
【问题描述】:

我正在使用带有滚动视图的布局。但是在 Logcat 中我得到了这个错误:“java.lang.IllegalStateException: ScrollView can host only one direct child”..Why??这里的滚动视图只有一个孩子,即;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>

提前致谢!!!

【问题讨论】:

    标签: android


    【解决方案1】:

    尝试清理您的项目并进行完全重建。过去我经历过这样的奇怪行为,在一些更改后资源似乎行为不端。

    【讨论】:

    • 谢谢...这是什么原因??
    • 它调用软件中的错误。现在问eclipse.org是什么原因?
    • 不确定,我怀疑该工具包正在执行一些“聪明”的增量构建(而不是在您进行更改时重新构建所有资源文件)并且有时它会出错。所以可能是 Android 工具中的一个错误。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-08-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多