Nested scroll View not scrolling smoothly with recyclerview android

前端 未结 3 1587
走了就别回头了
走了就别回头了 2020-12-16 02:19

I am using Nested Scrollview to wrap the recyclerview and other button. It worked perfectly but I noticed that when I scrolled it not smooth. Please guide how to make scroll

相关标签:
3条回答
  • 2020-12-16 03:00

    For smooth scrolling you can change the layout manager you have set in coding for recycler view. I hope it helps.

      RecyclerView.LayoutManager layoutManager = new  LinearLayoutManager(getActivity()) {
            @Override
            public boolean canScrollVertically() {
                return false;
            }
        };
        recyclerView.setLayoutManager(layoutManager);
    
    0 讨论(0)
  • 2020-12-16 03:12

    try below codes:

     RecyclerView recycleView = (RecyclerView) findViewById(R.id.lastest_product_list);
        recycleView.setNestedScrollingEnabled(false);
    

    You can modify your layout

    <ScrollView>
         <LinearLayout> 
             <android.support.v7.widget.RecyclerView
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:id="@+id/lastest_product_list"
                  android:nestedScrollingEnabled="false"
                  android:isScrollContainer="false">
            </android.support.v7.widget.RecyclerView>
        </LinearLayout>
    

    Check with link here : Recyclerview inside ScrollView not scrolling smoothly

    0 讨论(0)
  • 2020-12-16 03:14

    As per Android documentation android:nestedScrollingEnabled="false" works, but only on Android API level >= 21.

    If you want to support devices below API 21 as well, use the following:

    ViewCompat.setNestedScrollingEnabled(recyclerView, false);
    
    0 讨论(0)
提交回复
热议问题