Skip to content

与appbarlayout嵌套,事件冲突 解决方案 #1253

Open
@zhaobinsir

Description

@zhaobinsir

问题描述:当[CoordinatorLayout]嵌套横向banner时,在banner上点住上下滑动会失效。(banner2 本质就是viewpager2)
解决方案:
Banner.viewPager2.children.find { it is RecyclerView }?.let {
(it as RecyclerView).isNestedScrollingEnabled = false
}

问题原因:[ViewPager2]使用RecyclerView实现,RecyclerView吃掉了nested的一系列方法,导致无法回传至CoordinatorLayout,导致behavior失效,最终无法滑动
希望作者采纳!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions