NestedScrollView中嵌套ViewPager或RecyclerView出现滑动冲突的

NestedScrollView嵌套ViewPager出现的滑动冲突

问题描述:

ViewPager无法左右滑动, 切无内容显示. 如果有相关TabViewPager相绑定, 会导致Tab切换卡顿.

 

问题布局复原:

 

   

        android:id="@+id/home_scroll_view"

        android:layout_width="match_parent"

        android:layout_height="match_parent">

 

        

            android:layout_width="match_parent"

            android:layout_height="match_parent"/>

 

    

 

解决办法:

在相应ActivityFragment

NestedScrollView nestedScrollView = view.findViewById(R.id.home_scroll_view);

nestedScrollView.setFillViewport(true);

 

 

 

NestedScrollView中嵌套RecyclerView出现的滑动冲突

问题描述:

RecyclerView滑动出现卡顿

 

问题布局复原:

 

    

        android:id="@+id/home_scroll_view"

        android:layout_width="match_parent"

        android:layout_height="match_parent">

 

        

            android:layout_width="match_parent"

            android:layout_height="match_parent"/>

 

    

 

解决办法:

ActivityFragment, recyclerView设置如下代码:

recyclerView.setNestedScrollingEnabled(false);// 解决滑动冲突

你可能感兴趣的:(Android)