How can I detect keyboard opening and closing in jetpack compose?
Update With the new WindowInsets API, it gets easier First, to return the correct values, you need to set: WindowCompat.setDecorFitsSystemWindows(window, false) Then to use Keyboard as a state: @Composable fun keyboardAsState(): State<Boolean> { val isImeVisible = WindowInsets.ime.getBottom(LocalDensity.current) > 0 return rememberUpdatedState(isImeVisible) } use example: val isKeyboardOpen by keyboardAsState() // true or false ps: I’ve tried … Read more