- NestedScrollView 嵌套HorizontalScr
- NestedScrollView进入界面不能定位到顶部问题解决
- NestedScrollView嵌套Recyclerview列表
- CoordinatorLayout CollapsingToo
- 006 采坑-NestedScrollView嵌套ViewPag
- Scrollview (NestedScrollView) 嵌套
- NestedScrollView与RecyclerView的嵌套
- CoordinatorLayout、Behavior和嵌套滑动(
- NestedScrollView嵌套RecyclerView滑动
- NestedScrollView
图1
看整个图,用一个NestedScrollView包裹,最下面有两个表,然后可以横向滑动,我直接用横向的HorizontalScrollView,里面加两个RecyclerView,看起来貌似没问题,在模拟器上跑着感觉也正常,然后跑到手机上,会发现,第一次进入页面横向滑动最下面的布局,会直接把布局顶上去。然后就正常了,滑动布局多了总会多多少少有些奇奇怪怪的问题
解决方法,直接在NestedScrollView 外层布局添加android:descendantFocusability="blocksDescendants",viewgroup会覆盖子类控件而直接获得焦点
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/common_white"
android:descendantFocusability="blocksDescendants"
xmlns:zhy="http://schemas.android.com/tools">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
...
</androidx.core.widget.NestedScrollView>
</RelativeLayout>














网友评论