Android 无法使小部件可滚动

Android 无法使小部件可滚动,android,layout,widget,scrollview,imagebutton,Android,Layout,Widget,Scrollview,Imagebutton,我想创建一个图像按钮列表,我添加了3个按钮,但只有两个是可见的,我想让它们可以滚动。我试过使用ScrollView,但仍然不起作用。我还尝试用ScrollView替换第一行中的RelativeLayout,但应用程序开始崩溃 以下是xml文件: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-au

我想创建一个图像按钮列表,我添加了3个按钮,但只有两个是可见的,我想让它们可以滚动。我试过使用ScrollView,但仍然不起作用。我还尝试用ScrollView替换第一行中的RelativeLayout,但应用程序开始崩溃

以下是xml文件:

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/back"
tools:context=".home">

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

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/download"
            android:layout_gravity="center_horizontal"
            />

    </RelativeLayout>

</ScrollView>

<ScrollView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="230dp">

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:src="@drawable/geo" />
    </RelativeLayout>

</ScrollView>

<ScrollView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="4300dp">

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

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:src="@drawable/images"
            android:contentDescription="TODO" />

    </RelativeLayout>

</ScrollView>


将第一个滚动视图的宽度和高度作为换行内容。如果不起作用,则 仅创建一个滚动视图。然后创建一个线性布局作为其子级,并在具有垂直方向的线性布局中添加3个图像按钮。

可能的重复项