[AppBarLayout] fitsSystemWindows="true"
is ignored if wrapped inside CoordinatorLayout
without fitsSystemWindows
#4541
Labels
Description: With SDK 35 I had another look at edge-to-edge interactions. In my case I have a
androidx.coordinatorlayout.widget.CoordinatorLayout
as the root layout with a nestedcom.google.android.material.appbar.AppBarLayout
that hasandroid:fitsSystemWindows="true"
. The activity setsWindowCompat.setDecorFitsSystemWindows(getWindow(), false);
on creation. However,android:fitsSystemWindows
doesn't seem to have any influence on the visuals, so any text from the toolbar (and potential menu controls) are behind transparent controls (if present).As a workaround I wrote this snippet to apply the required padding manually:
If I apply this to all
com.google.android.material.appbar.AppBarLayout
s in my app, everything works as expected.Expected behavior: I would
android:fitsSystemWindows="true"
to apply this inset by itself. it works without issues when using it on the rootCoordinatorLayout
(which I want to be visible behind the controls, so that's why this is not an option).Source code:
Please not how
android:fitsSystemWindows="true"
works for the nestedCoordinatorLayout
without any issues.Android API version: 35
Material Library version: 1.12.0
Device: Probably all of them, tested in Emulator with Pixel 4a API 31
The text was updated successfully, but these errors were encountered: