Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
deverhjj opened this issue Mar 20, 2020 · 3 comments

Comments

@deverhjj
Copy link

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

@zhaoweiyan
Copy link

如何解决

@ckrgithub
Copy link

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

@ZDZN
Copy link

ZDZN commented Jul 14, 2022

@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 这段试试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants