App normally has this navigation bar:
But when I add ViewCompat.setOnApplyWindowInsetsListener()
ViewCompat.setOnApplyWindowInsetsListener(window.decorView) { _, insets ->
binding.showingKeyboard = insets.isVisible(WindowInsetsCompat.Type.ime())
WindowInsetsCompat.CONSUMED
}
or
ViewCompat.setOnApplyWindowInsetsListener(window.decorView) { _, insets ->
binding.showingKeyboard = insets.isVisible(WindowInsetsCompat.Type.ime())
insets
}
it becomes like this
Why does it happen? I don't want this method to change anything. I just want to use it to detect if the virtual keyboard is visible or not (there are no other good methods to do it)
ViewCompat.onApplyWindowInsets(v, insets)
instead ofinsets
>> don't forget to set the 1st parameter tov
– Serafinaserafine