Skip to content

Commit 1f6314c

Browse files
cketchamafohrman
authored andcommitted
Fix menu position bug in BottomAppBar
Fixes bug where the MenuView would not be positioned correctly if the first call to replaceMenu() happened after the view was laid out. PiperOrigin-RevId: 235046970
1 parent f354ff9 commit 1f6314c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/java/com/google/android/material/bottomappbar/BottomAppBar.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,9 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) {
728728

729729
setCutoutState();
730730
}
731+
732+
// Always ensure the MenuView is in the correct position after a layout.
733+
setActionMenuViewPosition();
731734
}
732735

733736
private BottomAppBarTopEdgeTreatment getTopEdgeTreatment() {
@@ -744,6 +747,9 @@ private void setCutoutState() {
744747
fab.setTranslationY(getFabTranslationY());
745748
fab.setTranslationX(getFabTranslationX());
746749
}
750+
}
751+
752+
private void setActionMenuViewPosition() {
747753
ActionMenuView actionMenuView = getActionMenuView();
748754
if (actionMenuView != null) {
749755
actionMenuView.setAlpha(1.0f);

0 commit comments

Comments
 (0)