I would watch the math flow of the offsetChildAsNeeded
method in AppBarLayout.ScrollingViewBehavior on running scrolling changes.
As it is private method and private is mOffsetDelta
, how can programmatically monitor them?
(It is not clear how the method uses offset
too.)
private void offsetChildAsNeeded(CoordinatorLayout parent, View child, View dependency) {
final CoordinatorLayout.Behavior behavior =
((CoordinatorLayout.LayoutParams) dependency.getLayoutParams()).getBehavior();
if (behavior instanceof Behavior) {
// Offset the child, pinning it to the bottom the header-dependency, maintaining
// any vertical gap, and overlap
final Behavior ablBehavior = (Behavior) behavior;
final int offset = ablBehavior.getTopBottomOffsetForScrollingSibling();
ViewCompat.offsetTopAndBottom(child, (dependency.getBottom() - child.getTop())
+ ablBehavior.mOffsetDelta
+ getVerticalLayoutGap()
- getOverlapPixelsForOffset(dependency));
}
}
NOTE: are welcome and could be accepted replies also the ones that explain details on math's logic of getTopBottomOffsetForScrollingSibling()
, of (dependency.getBottom() - child.getTop())
, and on the content of mOffsetDelta