final RelativeLayout view = (RelativeLayout)findViewById(R.id.activity_loading);
view.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if ((view.getRootView().getHeight() - view.getHeight()) >
view.getRootView().getHeight()/3) {
// keyboard is open
} else {
// keyboard is closed
}
}
});
Friday, December 21, 2012
Easy way to check if soft keyboard is open
Here's the really easy way to handle very specific 'soft' keyboard events: opening and closing.
Subscribe to:
Post Comments (Atom)
Fai RIRERE!
ReplyDeleteGreat thanks!!!
ReplyDeleteWon't work with modern keyboards, which can be less than 1/3 of screen height or even float around the window.
ReplyDeleteSuperrrrrrr.................Thank you
ReplyDeleteThanks for a brilliant solution!!!
ReplyDelete