'ViewCompat.setOnApplyWindowInsetsListener() changes background of system navigation bar
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)
Solution 1:[1]
Call setOnApplyWindowInsetsListener on root view of your layout, not on window.decorView
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|---|
| Solution 1 | Vlad Romanovsky | 


