From fdbf02569b8963b87ade505abb2fbb0dd82bf61b Mon Sep 17 00:00:00 2001 From: isabellekim Date: Tue, 9 Oct 2018 10:51:44 -0400 Subject: [PATCH] Ensures that bottom navigation item background Drawables don't share the same constant state. PiperOrigin-RevId: 216355891 --- .../material/bottomnavigation/BottomNavigationItemView.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/java/com/google/android/material/bottomnavigation/BottomNavigationItemView.java b/lib/java/com/google/android/material/bottomnavigation/BottomNavigationItemView.java index 061695be8..cf3f9e076 100644 --- a/lib/java/com/google/android/material/bottomnavigation/BottomNavigationItemView.java +++ b/lib/java/com/google/android/material/bottomnavigation/BottomNavigationItemView.java @@ -340,6 +340,9 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It } public void setItemBackground(@Nullable Drawable background) { + if (background != null && background.getConstantState() != null) { + background = background.getConstantState().newDrawable().mutate(); + } ViewCompat.setBackground(this, background); } }