Невозможно сделать виджеты прокручиваемыми - PullRequest
0 голосов
/ 07 октября 2018

Я хочу создать список кнопок изображений, и я добавил 3 из них, но видны только две, и я хочу сделать их прокручиваемыми.Я пытался использовать ScrollView, но он все еще не работает.Я также попытался заменить RelativeLayout в первой строке на ScrollView, но приложение начало падать.

Вот 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>

1 Ответ

0 голосов
/ 07 октября 2018

Сделать ширину и высоту первого вида прокрутки в качестве содержимого переноса. Если это не сработает, тогда Сделайте только один вид прокрутки. Затем сделайте линейный макет своим дочерним, а в линейном макете с вертикальной ориентацией добавьте 3 кнопки изображения..

...