As you may know starting with SDK 35 Google decided that apps should be "edge-to-edge" now.
So I'm working on adapting my old app to edge-to-edge.
I've encountered a problem with Material3 ModalBottomSheet. While it's parent activity works edge-to-edge, the sheet for some still hovers above navigation bar.
So far I've tried:
- Using "ThemeOverlay.Material3.BottomSheetDialog" as a theme
- Using "enableEdgeToEdge=true" in theme
- Using "app:paddingBottomSystemWindowInsets=false"
- Using "android:fitsSystemWindows="false" on both sheet layout and parent activity
- Deleting all content from the layout in case the problem is causes by margins/paddings
None of the above worked. For testing purposes the layout looks like this (in app it looks like the screehshot):
<?xml version="1.0" encoding="utf-8"?>
<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:fitsSystemWindows="false"
android:layout_height="wrap_content">
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:strokeWidth="0dp"
>
<FrameLayout
android:layout_width="32dp"
android:layout_height="32dp"/>
</com.google.android.material.card.MaterialCardView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
In code, it is CustomBottomModalDialog: BottomSheetDialogFragment(), where I inflate the layout and with viewbinding attach listeners to views. None of the code interacts with insets/margins/paddings so it's unlikely the problem is caused by the code.
I use Material3 ""com.google.android.material:material:1.13.0"" in case this is important.