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

FlexboxLayoutManager.computeScrollOffset(); It is wrong to be equal to 0 #610

Open
1 task
shenliangshanghai opened this issue Sep 2, 2022 · 1 comment

Comments

@shenliangshanghai
Copy link

Issues and steps to reproduce

*Why is flexboxmanager. Computescrolloffset() equal to 0 when only half of the first line is visible;I can't judge whether recyclerView.canScrollVertically() can continue to slide

Expected behavior

  • when only half of the first line is visible,should return Height of the first line invisible part
  • I found that the expectation of findfirstreferenceviewinline() was different from what I thought

Version of the flexbox library

*1.1.1 - 3.0.0

Link to code

//bottomSheetBehavior.java
if (!target.canScrollVertically(-1)) {
if (newTop <= collapsedOffset || hideable) {
if (!isDraggable) {
// Prevent dragging
return
}
consumed[1] = dyUnconsumed
ViewCompat.offsetTopAndBottom(child, -dyUnconsumed)
setStateInternal(STATE_DRAGGING)
} else {
consumed[1] = currentTop - collapsedOffset
ViewCompat.offsetTopAndBottom(child, -consumed[1])
setStateInternal(STATE_COLLAPSED)
}
}

@wojiaosuxiaobai
Copy link

wojiaosuxiaobai commented Dec 4, 2023

I have the same issue.

public static boolean isFirstViewCovered(FlexboxLayoutManager flexboxLayoutManager) {
        try {
            if (flexboxLayoutManager.findFirstVisibleItemPosition() == 0) {
                View firstView = flexboxLayoutManager.findViewByPosition(0);
                if (firstView != null) {
                    return isViewCoveredByParent(firstView);
                }
            }
        } catch (Throwable e) {
            Log.e("isFirstViewCovered", "error: " + e.getMessage());
        }

        return false;
    }

I made a compromise with this method

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

2 participants