Tell me when the keyboard opens with "adjustNothing"

In my application, I use the adjustNothing parameter on my keyboard. What is this requirement .. Please do not advise me to change it to “resize or pan” :)

My question is, is there a way to find out when the keyboard opens and closes in this state?

I tried onGlobalLayout and onConfigurationChanged without any luck. Since the keyboard does not “do” anything in the application, I don’t see a seam to find a way to capture this event. Please, help!

+4
source share
1 answer

Yes! It's not nice, like iOS, where you get height and animation, but in the list you know that it opens:

ViewCompat.setOnApplyWindowInsetsListener(findViewById(android.R.id.content), new OnApplyWindowInsetsListener() {
                @Override
                public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) {
}

This tells you about any changes. It is easy to understand that the keyboard is the cause of this change and acts accordingly.

+1
source

Source: https://habr.com/ru/post/1542031/


All Articles