美文网首页
NestedScrollView嵌套RecycleView时的问

NestedScrollView嵌套RecycleView时的问

作者: 墙裂的预感 | 来源:发表于2017-08-24 19:02 被阅读0次

1.滑动不流畅

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

mRecycleView.setNestedScrollingEnable(false);

2.启动时会自动滑动到ReycleView的顶部

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

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

android:descendantFocusability 有三个属性

优先于子控件获取焦点

“beforeDescendants"

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

”afterDescendants“

覆盖所有子控件获取焦点

”blocksDescendants“


原地址:www.cnblogs.com/erjia/p/6554607.html,感谢原作者

相关文章

网友评论

      本文标题:NestedScrollView嵌套RecycleView时的问

      本文链接:https://www.haomeiwen.com/subject/wkmtrxtx.html