Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tell when keyboard with "adjustNothing" opens

In my app I am using the adjustNothing flag to my keyboard. That it a requirement.. Please don't advice me to change it to "resize or pan" :)

My question is if there is any way of knowing when the keyboard opens and closes in this state?

I tried "onGlobalLayout" and "onConfigurationChanged" without any luck. Since the keyboard is not "doing" anything to the app I don't seam to find any way the catch this event.. Please help!

like image 774
roiberg Avatar asked May 26 '14 11:05

roiberg


1 Answers

Yes! It's not nice as iOS where you get the height and animation but at least 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 whenever any kind of change happens. It's easy knowing that the keyboard is the reason for that change and act accordingly.

like image 129
roiberg Avatar answered Oct 14 '22 21:10

roiberg