我在nestedscrollview中有一个recyclerview,我可以用touch事件滚动recyclelerview。但我的问题是当我快速滚动回收者视图时,在拿起我的手指后,滚动停止。但我想要的是,它会根据我手指的速度滑动。
这是我的布局: 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;
}
答案 0 :(得分:2)
将此添加到onCreateView
方法后尝试使用: -
recyclerView.setNestedScrollingEnabled(false);