简体   繁体   中英

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM