Jérémy CROS
09/14/2022, 4:58 PMConstraintLayout
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
with keyboardController?.hide()
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! 🙏Alex Vanyo
09/14/2022, 9:36 PMJérémy CROS
09/15/2022, 7:20 AMJérémy CROS
09/15/2022, 7:27 AMButton(
onClick = {
keyboardController?.hide()
onNextButtonClicked()
}
Alex Vanyo
09/15/2022, 3:40 PMandroid:windowSoftInputMode
strategy for your Activity
?
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 windowSoftInputMode
of adjustResize
.
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.Jérémy CROS
09/15/2022, 4:09 PMandroid:windowSoftInputMode="adjustResize"
in the manifestJérémy CROS
09/15/2022, 4:19 PM