File tree 1 file changed +9
-0
lines changed
lib/java/com/google/android/material/appbar
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -2593,11 +2593,20 @@ public void onOffsetChanged(
2593
2593
// children inside the ABL.
2594
2594
child .getDrawingRect (ghostRect );
2595
2595
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
+ }
2596
2604
ViewCompat .setClipBounds (child , ghostRect );
2597
2605
} else {
2598
2606
// Reset both the clip bounds and translationY of this view
2599
2607
ViewCompat .setClipBounds (child , null );
2600
2608
child .setTranslationY (0 );
2609
+ child .setVisibility (VISIBLE );
2601
2610
}
2602
2611
}
2603
2612
}
You can’t perform that action at this time.
0 commit comments