возвратное окно внутри вложенного прокрутки не прокручивает - PullRequest
0 голосов
/ 17 февраля 2020

У меня есть recyclerview внутри nestedScrollView, и я остановил прокрутку recyclerview, чтобы позволить nestedScrollView прокручивать всю страницу, но nestedScrollView не работает.

Я установил nestedScrollingEnabled для recyclerview на false

Я пытался добавить скрытое представление под recyclerview, но оно показывалось поверх нижних элементов recyclerview

Мой макет xml Код файла:

<?xml version="1.0" encoding="utf-8"?>

<layout xmlns:tools="http://schemas.android.com/tools"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:android="http://schemas.android.com/apk/res/android">

<data>
    <variable
        name="viewModel"
        type="com.accad.accadgame.viewmodels.profile.ProfileViewModel" />
</data>

<androidx.core.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true"
    >

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <de.hdodenhof.circleimageview.CircleImageView
            android:id="@+id/circleImageView"
            android:layout_width="75dp"
            android:layout_height="0dp"
            android:layout_marginStart="@dimen/default_dim"
            android:layout_marginTop="@dimen/default_xxdim"
            android:layout_marginEnd="@dimen/default_dim"
            android:src="@drawable/profile"
            app:layout_constraintDimensionRatio="h,1:1"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/profile_name"
            style="@style/HeadlineTextViewActiveStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/default_dim"
            android:layout_marginStart="@dimen/default_dim"
            android:layout_marginEnd="@dimen/default_dim"
            android:text="@{viewModel.profileName}"
            app:layout_constraintEnd_toEndOf="@+id/circleImageView"
            app:layout_constraintStart_toStartOf="@+id/circleImageView"
            app:layout_constraintTop_toBottomOf="@+id/circleImageView"
            tools:text="@tools:sample/lorem" />

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/profile_details_list"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_marginTop="@dimen/default_xxdim"
            android:clipToPadding="false"
            android:paddingBottom="@dimen/default_dim"
            android:paddingStart="@dimen/default_dim"
            android:nestedScrollingEnabled="false"
            app:layout_constraintBottom_toBottomOf="parent"
            android:focusable="false"
            app:layout_constraintTop_toBottomOf="@id/profile_name"
            />

    </androidx.constraintlayout.widget.ConstraintLayout>

</androidx.core.widget.NestedScrollView>

Ответы [ 2 ]

0 голосов
/ 17 февраля 2020

После многих попыток я нашел решение

, которое заключается в изменении высоты recyclerView на wrap_content вместо match_parent или 0dp, чтобы recyclerView быть таким:

<androidx.recyclerview.widget.RecyclerView
        android:id="@+id/profile_details_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/default_xxdim"
        android:clipToPadding="false"
        android:paddingBottom="@dimen/default_dim"
        android:paddingStart="@dimen/default_dim"
        android:nestedScrollingEnabled="false"
        app:layout_constraintBottom_toBottomOf="parent"
        android:focusable="false"
        app:layout_constraintTop_toBottomOf="@id/profile_name"
        />
0 голосов
/ 17 февраля 2020

Поместите ваш контент c в качестве первого элемента в RV.

Я знаю, что это может звучать плохо, но поверьте мне, это намного лучше, чем иметь вложенный RecyclerView.

Это исправит переработку, прокрутку, перетаскивание и многие другие проблемы с вложенным RV.

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