I have a RecyclerView inside a NestedScrollView. It's working fine when recyclerView adapter list size is small. But when list size is large , it's crashing my app (or make more lag). How can i fix it. Codes are below.
XML :
   <androidx.core.widget.NestedScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            >
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">
                 <com.google.android.material.textview.MaterialTextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="20dp"
                    android:layout_marginTop="10dp"
                    android:layout_marginRight="20dp"
                    android:text="0 Products"
                    android:textSize="16sp"
                    android:theme="@style/radio_font_textview" />
              <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/products_recycler"
                    android:layout_marginLeft="20dp"
                    android:layout_marginRight="20dp"
                    android:layout_marginTop="15dp"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"/>
            </LinearLayout>
        </androidx.core.widget.NestedScrollView>
JAVA :
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(ProductView.this);
productRecyclerAdapter = new ProductViewRecyclerAdapter(mData,mData2,ProductView.this);
products_recycler.setAdapter(productRecyclerAdapter);
ViewCompat.setNestedScrollingEnabled(products_recycler, false);
products_recycler.setLayoutManager(linearLayoutManager);