FlexboxLayoutManager.computeScrollOffset(); It is wrong to be equal to 0
shenliangshanghai opened this issue · comments
- I have searched existing issues and confirmed this is not a duplicate
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)
}
}
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