There's a space between content and keyboard when using imePadding
See original GitHub issueDescribe the bug
There’s a space between content and keyboard when using imePadding
and navigationBarsWithImePadding
To Reproduce
Steps to reproduce the behavior:
- When TextField is full I hid the keyboard
- When pressed again it pushed the TextField up, but the there’s a weird space between them
Screenshots?
My TextField is wrapContentHeight
and this is when i paste a long text

When i pressed back:

Pressed on TextField again:

Environment:
- Android OS version: [Android 8.0.0]
- Device: [LG V30 and Emulator Pixel 4XL]
- Accompanist version: [v0.15.0]
On this screen i have bottomSheetLayout
and bottomBar
. It worked fine in another screen, but i couldn’t find sth wrong it my code tho.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
TextField IME padding in LazyColumn , Compose
setDecorFitsSystemWindows(window,false) in the onCreate Method before setContent and I want to make text appear above the keyboard at all times ...
Read more >Android Jetpack Compose: Inset Padding Made Easy - Medium
Sometimes we want to expand our app content's view into these insets area, or we want to pad our view not to be...
Read more >Insets for Jetpack Compose - Accompanist - Google
The library now has experimental support for WindowInsetsAnimations , allowing your content is react to inset animations, such as the on screen-keyboard (IME) ......
Read more >Keyboard Handling In Jetpack Compose — All You Need To ...
The system resizes your layout to the available space, to make content accessible when the keyboard appears on the screen.
Read more >Text Field - Text goes below the IME [192043120]
The Text goes below the keyboard Because Of The Scroll State ... affects almost any use of TextField s within a scrolling area...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for the simple example! This is expected, but as you pointed out somewhat confusing behavior.
How insets are combined is in a
maxOf
sense, rather than a strictadditive
sense.So putting some numbers to it: Let’s say the navigation bar inset is
20
pixels from the bottom of the screen, and the top of the IME is100
pixels from the bottom of the screen.Then
navigationBarPadding()
will have a bottom value of20
pixels, andimePadding()
will have the bottom value of100
pixels. If both are applied, then the total padding will be120
pixels, but this is20
pixels too high: the top of the IME is only100
pixels from the bottom of the screen.navigationBarsWithImePadding()
“combines” these two types of insets, but it doesn’t do so just by adding them. Instead it takes themax
of each. So the bottom padding ofnavigationBarsWithImePadding
will be just100
pixels.If you wanted to split up the paddings, you will have to do that subtraction calculation yourself with the current accompanist APIs, since there isn’t communication from the parent to the child saying “I’ve already handled this portion of the insets”.
That communication is currently being experimented with insets support in
androidx.compose
, which would allow both approaches to work as you’d expect.Thanks Alex for this detailed explanation. I know understand why Accompanist insets work that way 👍🏼