美文网首页
Android_问题收集_NestedScrollView嵌套R

Android_问题收集_NestedScrollView嵌套R

作者: 宋木木的征途是星辰大海 | 来源:发表于2018-04-24 14:32 被阅读0次

滑动不流畅

遇到滑动时一卡一卡的情况;

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

mRecycleView.setNestedScrollingEnable(false);

切换时会自动滑动到 ReycleView 的顶部。

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

解决方法:
在 NestedScrollView 唯一子布局中加入 android:descendantFocusability=“blocksDescendants” ;
android:descendantFocusability有三个属性

属性 作用
beforeDescendants 优先于子控件获取焦点
afterDescendants 当子控件不需要焦点时,获取焦点
blocksDescendants 覆盖所有子控件获取焦点

相关文章

网友评论

      本文标题:Android_问题收集_NestedScrollView嵌套R

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