触摸事件后 recyclerview 快速滚动不起作用
recyclerview fast scroll not works after touch event
我在 nestedscrollview 中有一个 recyclerview,我可以使用触摸事件滚动 recyclerview。但我的问题是当我快速滚动 recyclerview 时,在拿起手指后,滚动停止。但我想要的是,它会根据我手指的速度滑动。
这是我的布局:
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>
我正在用片段给它充气
@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;
}
将此添加到您的 onCreateView
方法后尝试:-
recyclerView.setNestedScrollingEnabled(false);
我在 nestedscrollview 中有一个 recyclerview,我可以使用触摸事件滚动 recyclerview。但我的问题是当我快速滚动 recyclerview 时,在拿起手指后,滚动停止。但我想要的是,它会根据我手指的速度滑动。
这是我的布局: 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>
我正在用片段给它充气
@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;
}
将此添加到您的 onCreateView
方法后尝试:-
recyclerView.setNestedScrollingEnabled(false);