Hey everyone! :slightly_smiling_face: Keyboard qu...
# compose
Hey everyone! 🙂 Keyboard question here! (I know, those are the worst 😞) We have two pretty simple screens. First one has a
with a lottie animation, some text, a text field and a “next” button Second one also has a ConstraintLayout and a bunch of data displayed. When the text field is focused, keyboard shows up, taking up half the screen that becomes scrollable Issue is when clicking the “next” button when the keyboard is shown completely breaks the layout of the next screen I assume the keyboard is still there when the second screen is displayed. Nothing “clean” we’ve tried seems to solve that.
val keyboardController = LocalSoftwareKeyboardController.current
when clicking the button and before navigating away does absolutely nothing The only approach that seemed to work is to introduce some sort of delay.... Any idea? Much appreciated! 🙏
Does the keyboard eventually hide on the second screen after the first screen goes away?
yes it does, in fact, by the time (which is pretty instantaneous) the second screen is displayed, the keyboard is no longer there
to clarify further: • first screen, next is clicked with keyboard on -> second screen is shown right away with no keyboard but broken layout • first screen, next is clicked with keyboard off -> second screen is shown right away with no keyboard and ok layout And that’s with:
Copy code
    onClick = {
What is you current
strategy for your
? The way you’ll have the most control over the behavior is to handle insets yourself, by going edge-to-edge with
WindowCompat.setDecorFitsSystemWindows(window, false)
, and a
. Then, you can handle IME insets on a per-screen basis: On the second screen, where the keyboard won’t normally be visible, you can intentionally not adjust for the IME insets, so the second screen should be stable even if the keyboard is animating away due to previously being visible on the first screen.
we have
in the manifest
and thanks for the answer also 🙂 I’m not sure I understand completely your recommendation, would you mind giving a bit more details ? or if you have more resources on the subject, I’d be interested too 🙂