Skip to content

Instantly share code, notes, and snippets.

@JMPergar
Last active December 26, 2015 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JMPergar/7201960 to your computer and use it in GitHub Desktop.
Save JMPergar/7201960 to your computer and use it in GitHub Desktop.
Hide/Show Software Keyboard Event
mCVRoot.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
int heightDiff = mCVRoot.getRootView().getHeight() - mCVRoot.getHeight();
if (heightDiff > mDiffLimit) {
mOpenKeyboard = true;
// TODO
} else {
if (mOpenKeyboard) {
mOpenKeyboard = false;
// TODO
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment