AppbarLayoutBehavior icon indicating copy to clipboard operation
AppbarLayoutBehavior copied to clipboard

你这个解决方案不就是 杨充 的方案吗,但是还是有问题

Open deverhjj opened this issue 5 years ago • 3 comments

和 AppBarLayout 一起协作滚动的 兄弟可嵌套滚动的 view,比如 RecyclerView,在 RecyclerView fling 时,但是此时 AppBarLayout 还没滑出屏幕,此时 再去滚动 由于 shouldBlockNestedScroll 已经 为 true 会阻止 AppBarLayout 滚动,所以出现滚动断层现象!

deverhjj avatar Mar 20 '20 19:03 deverhjj

如何解决

zhaoweiyan avatar Jun 12 '20 09:06 zhaoweiyan

这里有个方案:https://github.com/ckrgithub/CollapsingRefresh

ckrgithub avatar Sep 08 '20 03:09 ckrgithub

@Override
public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, @NonNull AppBarLayout child, View target, int dx, int dy, int[] consumed, int type ) {
    if (type == TYPE_FLING) {
        isFlinging = true;
    }
    if (!shouldBlockNestedScroll) {
        super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed, type);
    } else if (TYPE_FLING == type) {
        if (null == consumed) consumed = new int[2];
        consumed[1] = dy;
    }
}

加上 else if 这段试试

ZDZN avatar Jul 14 '22 06:07 ZDZN