2017-07-02 56 views
0

我有一个recyclerview内nestedscrollview,我可以滚动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; 
} 

这里夸大,这是视频:https://youtu.be/OCu7Nobvblc

回答

2

尝试将它添加此之后您的onCreateView方法: -

recyclerView.setNestedScrollingEnabled(false); 
+0

泡芙,我想哭泣:-)谢谢。 –

+0

这项工作? –

+0

是的,我在网上搜索了两天。我尝试过,但现在它工作。 4分钟后,我将能够接受你的答案。非常感谢。 –