material-components-android
material-components-android copied to clipboard
[BottomAppBar] BottomAppBar casts a shadow
https://github.com/material-components/material-components-android/issues/2698...
Description: BottomAppBar (https://m3.material.io/components/bottom-app-bar/overview):
- Elevation: No shadow
- M3: Bottom app bar has new colors, a taller container, no elevation or shadow, and contains the FAB.
But, the BottomAppBar casts a shadow (https://github.com/material-components/material-components-android/issues/2852).
The MaterialToolbar casts no drop shadow (https://github.com/material-components/material-components-android/issues/2698#issuecomment-1233742799).
https://m3.material.io/components/top-app-bar/overview
https://github.com/material-components/material-components/issues/108
Expected behavior: The BottomAppBar casts no shadow. Or revise the documentation.
Source code:
<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.bottomappbar.BottomAppBar
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:layout_gravity="bottom" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
Minimal sample app repro: Test1.zip (https://github.com/material-components/material-components-android/issues/2852)
Android API version: 33
Material Library version: 1.7.0-rc01
Device: Emulator 31.3.10
I feel that's intended. @imhappi can you confirm this with the designers?
I want a document like https://material.io/design/environment/elevation.html.
I think @manabu-nakamura is right, the M3 guideline clearly says the redesigned M3 BottomAppBar doesn't have any elevation shadow (like the M3 top app bar, it also has no shadow), only the Surface Level 2 elevation tint.
In order to remove the shadow, I currently have to set app:elevation="0dp"
on the BottomAppBar and then programmatically
binding.bottomAppBar.setBackgroundColor(SurfaceColors.SURFACE_2.getColor(context));
to get the correct elevation tint without any shadow.
Thank you, @patzly. This method can also be used for the navigation bar (BottomNavigationView). https://m3.material.io/components/navigation-bar/overview
My method can not be used for the navigation bar:
((MaterialShapeDrawable)binding.appBar.getBackground()).setShadowCompatibilityMode(MaterialShapeDrawable.SHADOW_COMPAT_MODE_NEVER);
https://github.com/material-components/material-components-android/blob/master/lib/java/com/google/android/material/bottomappbar/BottomAppBar.java#L355:
materialShapeDrawable.setShadowCompatibilityMode(SHADOW_COMPAT_MODE_ALWAYS);
Hi! Sorry, I was out last week
Yes, the designer has confirmed that although there is elevation, there should be no shadow. Changes for this will go out soon