1、解决方法:嵌套滑动不激活。

recycleView.setNestedScrollingEnable(false); 

这样做有个弊端,RecycleView的item会一次性加载完,不管是否显示,如果item比较多的话不建议这样使用布局,如果再有下拉刷新,这种布局设计是非常糟糕的。

建议:只使用RecycleView,通过设置item类型来显示要展示的布局

   比如itemType = 0 填充Banner布局

   itemType = 1 填充菜单布局

   ....等等

 

2、当NestedScrollView嵌套RecycleView布局由Fragment管理,Fragment切换时会自动滑动到ReycleView的顶部。

 

解决方法:在NestedScrollView唯一子布局中加入 android:descendantFocusability=“blocksDescendants”

android:descendantFocusability 有三个属性

优先于子控件获取焦点

“beforeDescendants"

当子控件不需要焦点时,获取焦点

”afterDescendants“

覆盖所有子控件获取焦点

”blocksDescendants“

相关文章:

  • 2021-12-05
  • 2022-01-21
  • 2022-01-10
  • 2021-12-05
  • 2021-07-29
  • 2021-09-24
  • 2022-01-10
猜你喜欢
  • 2021-05-04
  • 2021-12-07
  • 2022-12-23
  • 2021-12-07
  • 2021-05-17
  • 2021-06-12
  • 2021-09-29
相关资源
相似解决方案