ViewPager滑动和RecyclerView滚动之间的冲突

Liy*_*iya 2 android android-recyclerview

在我的应用程序中,我有一个ViewPager不同的选项卡.每个选项卡仅由一个RecyclerView可以垂直滚动的选项卡组成.

我的问题是,当我尝试导航到其他选项卡并向左或向右滑动RecyclerView's时,首先检测滚动,而不是转到另一个选项卡RecyclerView滚动.

我尝试了以下回收者视图的属性:

         rv_home.setNestedScrollingEnabled(false);
Run Code Online (Sandbox Code Playgroud)

那个时间ViewPager滑动按预期工作但是垂直滚动recycler view禁用.我该怎么办?

小智 5

v_home.setHasFixedSize(true);
    RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getApplicationContext(),
            LinearLayoutManager.VERTICAL, false);
    layoutManager.setAutoMeasureEnabled(true);
    rv_home.setNestedScrollingEnabled(false);
    rv_home.setLayoutManager(layoutManager);
Run Code Online (Sandbox Code Playgroud)

试试这个