Hello, I am having a problem with Ime paddings and...
# compose
t
Hello, I am having a problem with Ime paddings and
BottomSheetDialogFragment
. It looks like ime padding is not applying on APIs 29 and lower.
1
I am using compose
1.2.0-beta03
, but it was also not working on older versions with Accompanist insets. When I looked at
isImeVisible
it looks like it is set to true very first time and then as I close and open the keyboard nothing changes.
I have set
android:windowSoftInputMode="adjustResize"
and this is my sample bottom sheet fragment:
z
Just to confirm, have you also called
setDecorFitsSystemWindows(false)
?
a
BottomSheetDialogFragment
from MDC is a very special case. I believe the flag you’re looking for is
app:enableEdgeToEdge
, as documented here: https://github.com/material-components/material-components-android/blob/master/docs/components/BottomSheet.md#handling-insets-and-fullscreen Without that flag,
BottomSheetDialogFragment
sets
fitSystemWindows
in some components, and eats the insets from you
👀 1
t
Yes, I tried setting
WindowCompat.setDecorFitsSystemWindows(window, false)
to my Activity. And also used this theme for bottom sheet but it is still not working:
Copy code
<style name="Theme.Sample.BottomSheetDialog" parent="Theme.Design.BottomSheetDialog">
    <item name="enableEdgeToEdge">true</item>
</style>
a
It looks like there’s a note about another requirement for
enableEdgeToEdge
to work:
if the navigation bar is transparent
Also, the
BottomSheetDialogFragment
’s has a different
Window
than the
Activity
, so if you’re updating the status bar color or the navigation bar color of the
Window
, make sure you’re updating the right one
One of the most recent updates to
accompanist/systemuicontroller
allows passing in the
Window
instance to adjust, for this use case exactly 😄
t
Thank you, it looks like I was not updating the right
Window
. But it was still not working, what I also needed to do was to use
Theme.Material3.Light.BottomSheetDialog
I was not able to make the ime paddings work with non Material 3 theme.
509 Views