File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
lib/java/com/google/android/material/appbar Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -2593,11 +2593,20 @@ public void onOffsetChanged(
25932593 // children inside the ABL.
25942594 child .getDrawingRect (ghostRect );
25952595 ghostRect .offset (0 , (int ) -offsetY );
2596+ // If the ghost rect is completely outside the bounds of the drawing rect, make this child
2597+ // invisible. Otherwise, on API <= 24 a ghost rect that is outside of the drawing rect will
2598+ // be ignored and the child would be drawn with no clipping.
2599+ if (offsetY >= ghostRect .height ()) {
2600+ child .setVisibility (INVISIBLE );
2601+ } else {
2602+ child .setVisibility (VISIBLE );
2603+ }
25962604 ViewCompat .setClipBounds (child , ghostRect );
25972605 } else {
25982606 // Reset both the clip bounds and translationY of this view
25992607 ViewCompat .setClipBounds (child , null );
26002608 child .setTranslationY (0 );
2609+ child .setVisibility (VISIBLE );
26012610 }
26022611 }
26032612 }
You can’t perform that action at this time.
0 commit comments