Today, I set out to better understand IME padding. In particular, in the context of keeping scrolled...
t

Travis Griggs

over 1 year ago
Today, I set out to better understand IME padding. In particular, in the context of keeping scrolled content visible when the keyboard opens. I have read again through https://developer.android.com/develop/ui/compose/layouts/insets . I built a simplish example to play/experiment with, shown in the first screenshot. Its composable heirarchy looks like: LazyColumn ElevatedCard(s) Column Text, Spacer, BasicTextField, Spacer, BasicTextFieldSpacer The goal is that when I click on either text field in the card, and the keyboard appears, the entire card scrolls if necessary to stay visible. But when I click on either, I see the second screenshot. The content will slide up to make sure the BasicTextField is visible, but none of the rest of the card. I have thrown imePadding, imeNestedScrolling, and consumeWindowInsets(WindowInsets.ime) at multiple combinations of places in the hierarchy, but none seem to have any effect at all (I wonder if any effects are being hidden by the keyboard itself?) I'm curious if any form of padding is going to solve this problem? Dynamically adjusting the vertical height of something in a scrolled list will just change it's height, but not it's scrolled offset. Am I going to have employ a solution that gets into the guts more? Obviously, there's something that causes the text field itself to pull upwards to stay visible, just not sure where that is happening. I can put code in thread if needed.