Java android编程中的ScrollView

Java android编程中的ScrollView,java,android,scrollview,Java,Android,Scrollview,我在xml文件中使用了scrollview,但当我这样做时: 程序拒绝运行此应用程序。(图一) 但是,当我取出scrollview的代码时,它会返回到正常形式: 那么我应该怎么做才能使scrollview正常工作呢 注意:我将scrollview代码放在代码的顶部。ex: <ScrollView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id=

我在xml文件中使用了scrollview,但当我这样做时:

程序拒绝运行此应用程序。(图一)

但是,当我取出scrollview的代码时,它会返回到正常形式:

那么我应该怎么做才能使scrollview正常工作呢

注意:我将scrollview代码放在代码的顶部。

ex:

<ScrollView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/scrollView"
    android:layout_below="@+id/textView"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true"
    android:fillViewport="false"
    android:layout_above="@+id/button">
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/linearLayout"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:orientation="vertical"
        android:layout_gravity="top">
    </LinearLayout>
</ScrollView>


程序拒绝运行此应用程序。
?我想这是件好事,因为您正试图将所有这些元素放入scrollview中,而scrollview只承载一个子元素…因此,添加scrollview,然后添加线性布局作为子元素,然后使用它们创建表单…另一件事是,当您尝试放置滚动查看根元素。把它放在相对布局中logcat中的任何错误?