Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/218.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 错误:呈现期间引发异常:ScrollView只能承载一个直接子级_Android_Xml - Fatal编程技术网

Android 错误:呈现期间引发异常:ScrollView只能承载一个直接子级

Android 错误:呈现期间引发异常:ScrollView只能承载一个直接子级,android,xml,Android,Xml,我正试图设计一个应用程序,但当我把一个滚动视图放在全身时,我说 呈现期间引发异常:ScrollView只能承载一个直接子级 我做错了什么 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation=

我正试图设计一个应用程序,但当我把一个滚动视图放在全身时,我说

呈现期间引发异常:ScrollView只能承载一个直接子级

我做错了什么

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:id="@+id/root">

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">


    <include
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        layout="@layout/toolbar"
        android:layout_alignParentTop="true"
        android:layout_alignLeft="@+id/title"
        android:layout_alignStart="@+id/title" />


    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="400dp"
        android:background="#303F9F"
        android:id="@+id/layout">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/title"
            android:gravity="center"
            android:hint="Title"
            android:textSize="23dp"
            android:text="@string/contenido"
            android:textColor="#fff"
            android:layout_gravity="center"
            android:layout_marginLeft="35dp"
            android:layout_marginRight="35dp"
            android:layout_marginTop="140dp"/>

        <include
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            layout="@layout/view_include_footer"
            android:layout_alignParentBottom="true"
            />


    </RelativeLayout>
    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true">

        <android.support.v7.widget.RecyclerView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/comment_rv"
            android:layout_below="@+id/setting_toolbar"
            android:scrollbars="vertical"
            android:background="#ccffffff"
            />
    </RelativeLayout>
    </ScrollView>

</LinearLayout>

ScrollView只能承载一个直接子元素,这意味着您可以在其中直接使用一个元素。创建一个RelativeLayout或最适合您的内容,将您的include和两个RelativeLayout放在其中,并将此布局放在ScrollView中。只有这样你才能有一个直系子女

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/root">

<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

<include
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    layout="@layout/toolbar"
    android:layout_alignParentTop="true"
    android:layout_alignLeft="@+id/title"
    android:layout_alignStart="@+id/title" />


<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="400dp"
    android:background="#303F9F"
    android:id="@+id/layout">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/title"
        android:gravity="center"
        android:hint="Title"
        android:textSize="23dp"
        android:text="@string/contenido"
        android:textColor="#fff"
        android:layout_gravity="center"
        android:layout_marginLeft="35dp"
        android:layout_marginRight="35dp"
        android:layout_marginTop="140dp"/>

    <include
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        layout="@layout/view_include_footer"
        android:layout_alignParentBottom="true"
        />


</RelativeLayout>
<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true">

    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/comment_rv"
        android:layout_below="@+id/setting_toolbar"
        android:scrollbars="vertical"
        android:background="#ccffffff"
        />
</RelativeLayout>
</RelativeLayout>
</ScrollView>


ScrollView只能承载一个直接子元素,这意味着您可以在其中直接使用一个元素。创建一个RelativeLayout或最适合您的内容,将您的include和两个RelativeLayout放在其中,并将此布局放在ScrollView中。只有这样你才能有一个直系子女

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/root">

<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

<include
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    layout="@layout/toolbar"
    android:layout_alignParentTop="true"
    android:layout_alignLeft="@+id/title"
    android:layout_alignStart="@+id/title" />


<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="400dp"
    android:background="#303F9F"
    android:id="@+id/layout">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/title"
        android:gravity="center"
        android:hint="Title"
        android:textSize="23dp"
        android:text="@string/contenido"
        android:textColor="#fff"
        android:layout_gravity="center"
        android:layout_marginLeft="35dp"
        android:layout_marginRight="35dp"
        android:layout_marginTop="140dp"/>

    <include
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        layout="@layout/view_include_footer"
        android:layout_alignParentBottom="true"
        />


</RelativeLayout>
<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true">

    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/comment_rv"
        android:layout_below="@+id/setting_toolbar"
        android:scrollbars="vertical"
        android:background="#ccffffff"
        />
</RelativeLayout>
</RelativeLayout>
</ScrollView>


ScrollView只能承载一个直接子元素,这意味着您可以在其中直接使用一个元素。创建一个RelativeLayout或最适合您的内容,将您的include和两个RelativeLayout放在其中,并将此布局放在ScrollView中。只有这样你才能有一个直系子女

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/root">

<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

<include
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    layout="@layout/toolbar"
    android:layout_alignParentTop="true"
    android:layout_alignLeft="@+id/title"
    android:layout_alignStart="@+id/title" />


<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="400dp"
    android:background="#303F9F"
    android:id="@+id/layout">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/title"
        android:gravity="center"
        android:hint="Title"
        android:textSize="23dp"
        android:text="@string/contenido"
        android:textColor="#fff"
        android:layout_gravity="center"
        android:layout_marginLeft="35dp"
        android:layout_marginRight="35dp"
        android:layout_marginTop="140dp"/>

    <include
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        layout="@layout/view_include_footer"
        android:layout_alignParentBottom="true"
        />


</RelativeLayout>
<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true">

    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/comment_rv"
        android:layout_below="@+id/setting_toolbar"
        android:scrollbars="vertical"
        android:background="#ccffffff"
        />
</RelativeLayout>
</RelativeLayout>
</ScrollView>


ScrollView只能承载一个直接子元素,这意味着您可以在其中直接使用一个元素。创建一个RelativeLayout或最适合您的内容,将您的include和两个RelativeLayout放在其中,并将此布局放在ScrollView中。只有这样你才能有一个直系子女

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/root">

<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

<include
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    layout="@layout/toolbar"
    android:layout_alignParentTop="true"
    android:layout_alignLeft="@+id/title"
    android:layout_alignStart="@+id/title" />


<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="400dp"
    android:background="#303F9F"
    android:id="@+id/layout">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/title"
        android:gravity="center"
        android:hint="Title"
        android:textSize="23dp"
        android:text="@string/contenido"
        android:textColor="#fff"
        android:layout_gravity="center"
        android:layout_marginLeft="35dp"
        android:layout_marginRight="35dp"
        android:layout_marginTop="140dp"/>

    <include
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        layout="@layout/view_include_footer"
        android:layout_alignParentBottom="true"
        />


</RelativeLayout>
<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true">

    <android.support.v7.widget.RecyclerView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/comment_rv"
        android:layout_below="@+id/setting_toolbar"
        android:scrollbars="vertical"
        android:background="#ccffffff"
        />
</RelativeLayout>
</RelativeLayout>
</ScrollView>


我以前遇到过这个问题,很明显ScrollView只能承载一个直接子级。这意味着你不应该使用两个!子视图,在ScrollView中,仅围绕两个子视图的相对外层。

我在前面遇到过这个问题,很明显ScrollView只能承载一个直接子视图。这意味着你不应该使用两个!子视图,在ScrollView中,仅围绕两个子视图的相对外层。

我在前面遇到过这个问题,很明显ScrollView只能承载一个直接子视图。这意味着你不应该使用两个!子视图,在ScrollView中,仅围绕两个子视图的相对外层。

我在前面遇到过这个问题,很明显ScrollView只能承载一个直接子视图。这意味着你不应该使用两个!子视图和ScrollView中,只需围绕两个子视图的相对外部。

感谢您回答Vastal,请按照我说的方式检查它,但有一个问题是,属性android:layout\u height=“match\u parent”RecyclerView,未正确实现,因为当我尝试显示日志时,只显示一条两条记录,因为发生了问题。请使用ScrollView感谢回答Vastal。请按照我说的方式检查它,但问题是,属性android:layout\u height=“match\u parent”的RecyclerView,未正确实现,因为当我尝试显示日志时,只显示一条两条记录,因为发生了问题。请使用ScrollView感谢回答Vastal。请按照我说的方式检查它,但问题是,属性android:layout\u height=“match\u parent”的RecyclerView,未正确实现,因为当我尝试显示日志时,只显示一条两条记录,因为发生了问题。请使用ScrollView感谢回答Vastal。请按照我说的方式检查它,但问题是,属性android:layout\u height=“match\u parent”的RecyclerView,未正确实现,因为当我尝试显示日志时,只显示一条两条记录,因为它发生在problam的ScrollView中