在ScrollView内设置ViewPager2#currentItem会导致ScrollView垂直滚动[y scroll]

时间:2020-07-13 12:24:07

标签: android android-viewpager scrollview android-viewpager2

如果您在项目中运行以下布局

{
    "firstName" : "ker",
    "lastName" : "ope",
    "email" : "ker@gmail.com",
    "department" : {
        "id" : 6,
        "deptName" : "dept1",
        "deptHOD" : "hod1"
    }
}

并更改root: ScrollView(width: match_parent, height: match_parent) { child: LinearLayout(width: match_parent, height: wrap_content; VERTICAL) { child: SomeView(width: match_parent, height: 80% of screen height) child: ViewPager2(width: match_parent, height: 40% of screen height) } } 的当前页面(当它在屏幕上不完全可见时),除了更改页面外,它还会导致ScrollView上的滚动(因此其底部等于到屏幕底部)。

为什么会发生这种情况,如何使之不发生?我找不到任何避免方法。

0 个答案:

没有答案