material-components-android
material-components-android copied to clipboard
[Navigation Bar] BottomNavigationView casts a shadow
Description: Do we have to use the BottomNavigationView with the LinearLayout? https://m3.material.io/components/navigation-bar/implementation https://github.com/material-components/material-components-android/issues/2953#issuecomment-1249034716 The BottomNavigationView with the LinearLayout casts no shadow:
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom">
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNavigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:menu="@menu/main" />
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
The BottomNavigationView without the LinearLayout casts a pale shadow:
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNavigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:menu="@menu/main" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
Expected behavior: The BottomNavigationView without the LinearLayout casts no shadow.
Minimal sample app repro: Editor2.zip
Android API version: 33
Material Library version: 1.7.0-rc01
Device: Emulator 31.3.10
It's not bug. The main problem is that the bottom menu does not have any top margin. I think that's the reason why you dont see the elevation.
fixed in e3937483c36449f71bc00a5b9376198345060f89