Muhammed Yusuf Muhammed Yusuf - 3 months ago 24
Android Question

recyclerview fast scroll not works after touch event

I have an recyclerview inside nestedscrollview and I can scroll the recyclerview with touch event. But my problem is when I scroll fastly the recyclerview, after picking up my finger, the scrolling stops. But what I want is, it will slide depending on my finger's speed.

Here is my layout:
item_container_list.xml

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

<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp">


<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="true"
android:id="@+id/container_list">

</android.support.v7.widget.RecyclerView>

</android.support.v4.widget.NestedScrollView>

</RelativeLayout>


I am inflating this with a fragment

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.item_container_list,container,false);

recyclerView = (RecyclerView)view.findViewById(R.id.container_list);

layoutManager = new LinearLayoutManager(this.getContext(), LinearLayoutManager.VERTICAL, false);

recyclerView.setLayoutManager(layoutManager);
//recyclerView.addItemDecoration(new SimpleDividerItemDecoration(this.getContext()));

return view;
}


Here is video: https://youtu.be/OCu7Nobvblc

Answer Source

Try to it after adding this to your onCreateView method :-

recyclerView.setNestedScrollingEnabled(false);