NestedScrollView 嵌套HorizontalScrollView+ListView时左右滑动会将列表顶到屏幕顶部

it2024-10-25  36

项目场景:

NestedScrollView 下面嵌套了普通布局+Fragment(Fragment是一种类似于股票报价表的结构,允许上下左右滚动)。

Fragment内有ScrollView+ListView+HorizontalScrollView+ListView布局。


问题描述:

在左右滑动时,会触发NestedScrollView滚动操作,并将整个Fragment滚动到顶端,普通布局被顶到可视界面外面了。


解决方案:

在NestedScrollView的父布局中加入 android:descendantFocusability=“blocksDescendants”

 

最新回复(0)