스크롤링 변경 사항을 실행할 때 AppBarLayout.ScrollingViewBehavior에서 offsetChildAsNeeded
메서드의 수학 흐름을 보았습니다.AppBarLayout.ScrollingViewBehavior의 수학은 어떻게 작동합니까?
개인 방법이며 개인은 mOffsetDelta
이므로 프로그래밍 방식으로 모니터링 할 수 있습니까?
(방법이 너무 offset
를 사용하는 방법 그것은 분명하지 않다.)
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));
}
}
참고 : 환영하며 (dependency.getBottom() - child.getTop())
의, getTopBottomOffsetForScrollingSibling()
의 수학의 논리에 대한 자세한 내용을 설명하는 사람을 응답을받을 수 있었다, 및 mOffsetDelta
달성하려는 계획보다는 최종 목표를 설명하는 것이 좋습니다. – natario
마지막 목표는 스크롤을 변경하는 동안 동작이 어떻게 작동하는지 배우는 것입니다. – GPack
'AppBarLayout.ScrollingViewBehavior' 클래스를 프로젝트에 추가하고, 변경하고,'AppBarLayout'의'app : layout_behavior'가 이익이되도록합니다. –