Невозможно прокрутить при добавлении scrollview или nestedscrollview внутри viewpager - PullRequest
0 голосов
/ 18 октября 2019

У меня проблема в том, что приложение не может прокручиваться, когда я добавляю представление scrollview или nestedscroll внутри элемента viewpager

Это просмотрщик в файле XML

<androidx.viewpager.widget.ViewPager
                android:id="@+id/materialVP"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:nestedScrollingEnabled="true"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_behavior="@string/appbar_scrolling_view_behavior"
                app:layout_constraintTop_toBottomOf="@+id/tabs">

и это элемент, который я хочу, чтобы он был прокручиваемым


<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:android="http://schemas.android.com/apk/res/android"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        android:layout_width="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        android:fillViewport="true"
        android:layout_weight="1"
        android:layout_height="wrap_content">
        <LinearLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:paddingLeft="@dimen/marginActivity"
            android:orientation="vertical">

            <LinearLayout
                android:orientation="horizontal"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">
                <TextView
                    style="@style/textInfoDate"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:text="@string/date_cmd" />

                <TextView
                    android:id="@+id/date_cmd"
                    android:layout_marginLeft="20dp"
                    style="@style/tvInfoDate"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    />
            </LinearLayout>
            <LinearLayout
                android:orientation="horizontal"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">
                <TextView
                    style="@style/textInfoDate"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:text="@string/date_liv_souhaite_ISIS" />

                <TextView
                    android:id="@+id/date_souhait_isis"
                    android:layout_marginLeft="20dp"
                    style="@style/tvInfoDate"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    />
            </LinearLayout>
            <LinearLayout
                android:orientation="horizontal"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">
                <TextView

                    style="@style/textInfoDate"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:text="@string/date_liv_souhaite_Dis" />

                <TextView
                    android:id="@+id/date_souhait_dist"
                    android:layout_marginLeft="20dp"
                    style="@style/tvInfoDate"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    />
            </LinearLayout>

            <LinearLayout
                android:orientation="horizontal"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">
                <TextView
                    style="@style/textInfoDate"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:text="@string/date_MADA_previ" />
                <TextView
                    android:id="@+id/date_mada_previ"
                    android:layout_marginLeft="20dp"
                    style="@style/tvInfoDate"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    />
            </LinearLayout>
            <LinearLayout
                android:orientation="horizontal"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">
                <TextView
                    style="@style/textInfoDate"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:text="@string/date_MADA_engag" />

                <TextView
                    android:id="@+id/date_mada_engag"
                    android:layout_marginLeft="20dp"
                    style="@style/tvInfoDate"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    />
            </LinearLayout>
            <LinearLayout
                android:orientation="horizontal"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">
                <TextView
                    style="@style/textInfoDate"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:text="@string/date_MADC" />

                <TextView
                    android:id="@+id/date_madc"
                    android:layout_marginLeft="20dp"
                    style="@style/tvInfoDate"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    />
            </LinearLayout>
        </LinearLayout>
    </androidx.core.widget.NestedScrollView>


Я ожидал прокрутить список, но он не может прокручиваться. Я использую Android Studio 3.5, даже когда я добавил в службу ресиверов, я не могу прокрутитьсписок, я думаю, что есть проблема в viewpager

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...