material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

[Navigation Bar] BottomNavigationView casts a shadow

Open manabu-nakamura opened this issue 2 years ago • 1 comments

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>

Screenshot_20220922_130226 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>

Screenshot_20220922_130204

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

manabu-nakamura avatar Sep 22 '22 05:09 manabu-nakamura

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.

michael-winkler avatar Sep 22 '22 05:09 michael-winkler

fixed in e3937483c36449f71bc00a5b9376198345060f89

imhappi avatar Oct 28 '22 17:10 imhappi