Android 为什么使用nestedScrollView分页的RecyclerView会降低应用程序的速度?

Android 为什么使用nestedScrollView分页的RecyclerView会降低应用程序的速度?,android,performance,android-studio,android-recyclerview,pagination,Android,Performance,Android Studio,Android Recyclerview,Pagination,我在recyclerview中实现分页,当一些产品加载到recyclerview时,分页速度会减慢,在一些设备(如三星s6)上,分页会崩溃 注: 如果Recyclerview位于nestedScrollview下,则应用程序速度会减慢,否则效果会很好 我已经测试了几乎所有我在互联网上搜索的解决方案,但可以解决这个问题 <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.andr

我在recyclerview中实现分页,当一些产品加载到recyclerview时,分页速度会减慢,在一些设备(如三星s6)上,分页会崩溃

注: 如果Recyclerview位于nestedScrollview下,则应用程序速度会减慢,否则效果会很好

我已经测试了几乎所有我在互联网上搜索的解决方案,但可以解决这个问题

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">


<androidx.swiperefreshlayout.widget.SwipeRefreshLayout

    android:id="@+id/swipeContainer"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <androidx.core.widget.NestedScrollView

        android:id="@+id/containers_parent"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/colorDarkGray"
        android:visibility="visible">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/colorGreen"
            android:orientation="vertical">

            <!--image slider-->
            <ViewFlipper
                android:id="@+id/vf_slider"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:minHeight="@dimen/_200dp"
                android:visibility="gone"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

            <include

                android:id="@+id/recommendation_container_parent"
                layout="@layout/reccomendation_products_layout"
                app:layout_constraintBottom_toTopOf="@+id/pb_product_load"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/brands_in_focus_container" />

        </LinearLayout>
    </androidx.core.widget.NestedScrollView>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

在s6上崩溃时出现的错误是什么?参数代表什么?还需要发布崩溃日志还需要为recyclerview设置
recyclerview.setNestedScrolling(false)
。@AjayPandya Logcat不显示任何错误。但我最关心的是制作卷轴smoothly@Piyush参数用于更多项目的改装调用(分页)。
adapter = new ProductAdapter(getContext(), this);
    adapter.setData(productList);
    fragment.recommendationContainerParent.rvRecommendedProducts.setAdapter(recommendationProductAdapter);
    gridLayoutManager = new GridLayoutManager(getContext(), 2);


    fragment.recommendationContainerParent.rvRecommendedProducts.setLayoutManager(gridLayoutManager);


    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
        fragment.recommendationContainerParent.rvRecommendedProducts.setNestedScrollingEnabled(false);
    } else {
        ViewCompat.setNestedScrollingEnabled(fragment.recommendationContainerParent.rvRecommendedProducts, false);
    }

    fragment.containersParent.setOnScrollChangeListener((NestedScrollView.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
        if (v.getChildAt(v.getChildCount() - 1) != null) {
            if ((scrollY >= (v.getChildAt(v.getChildCount() - 1).getMeasuredHeight() - v.getMeasuredHeight())) &&
                    scrollY > oldScrollY) {
                //code to fetch more data for endless scrolling


                if (!isLoading) {


                    isLoading = true;

                    parameters.clear();

                    INITIAL_INDEX = END_INDEX;
                    INITIAL_INDEX++; // starting from end+1
                    END_INDEX += NUMBER_OF_ITEM;

                    parameters.put(START_INDEX, String.valueOf(INITIAL_INDEX));
                    parameters.put(LENGTH, String.valueOf(NUMBER_OF_ITEM));

                    getProductItems();
                }

            }

        }
    });

    void getProductItems() {

    parameters.put(RECOMMENDED_CAT_TOKEN, recommended_cat);

    homeViewModel.getRecommendations(parameters).observe(this, productContainer -> {

        if (productContainer != null && productContainer.getProductData().getProducts().size() > 0) {

            productList.addAll(productContainer.getProductData().getProducts());
            recommendationProductAdapter.notifyDataSetChanged();

            isLoading = false;
        }

    });
}