Проблема NestedScrollView с RecyclerView - PullRequest
0 голосов
/ 12 января 2019

Когда мы используем RecyclerView внутри NestedScrollView приложения, застрявшего там, где мы вызываем notifyDatasetChanged или вставляемое уведомление, это происходит из-за того, что когда мы вызываем notify, он вызывает все элементы одновременно («он вызвал onBindViewHolder одновременно»), поэтому Есть ли решение для решения этой проблемы? Если я удаляю NestedScrollView, это работает, но мы не можем использовать несколько макетов («пример 2 RecyclerView»)

код

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:custom="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="@color/lightback"
    android:id="@+id/main_layouta"
    android:orientation="vertical"
    tools:ignore="NamespaceTypo">
    <include layout="@layout/toolbar_social" />


    <android.support.v4.widget.NestedScrollView
        android:id="@+id/nestedview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
    </android.support.v4.widget.NestedScrollView>

        <android.support.v4.widget.NestedScrollView
            android:fillViewport="true"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"

            app:layout_behavior="@string/appbar_scrolling_view_behavior">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
   <include layout="@layout/below_toolbar_header_layout"/>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <android.support.v7.widget.RecyclerView
            android:id="@+id/recyc_social_stories"
            android:layout_width="match_parent"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"

            android:layout_height="wrap_content"
            android:layout_marginStart="10dp"
            android:layout_marginLeft="5dp"
            android:nestedScrollingEnabled="false"
            android:layout_marginRight="5dp"
            android:layout_marginTop="10dp" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/white"
            android:orientation="vertical"
            android:paddingBottom="5dp">


            <android.support.v7.widget.RecyclerView
                android:id="@+id/recyc_social_post"
                android:layout_width="match_parent"
                android:visibility="gone"
                app:layout_behavior="@string/appbar_scrolling_view_behavior"

                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:nestedScrollingEnabled="false" />

            <ProgressBar
                android:layout_width="match_parent"
                android:id="@+id/progress_bar"
                android:layout_height="match_parent" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:background="@color/white"
            android:layout_height="20dp" />
    </LinearLayout>
        </LinearLayout>
        </android.support.v4.widget.NestedScrollView>

</LinearLayout>
...