Created
October 7, 2019 01:02
-
-
Save ramseth001/8fccf313c2b9a987377a58542e1221d5 to your computer and use it in GitHub Desktop.
Disable keyboard on click outside edittext
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public boolean dispatchTouchEvent(MotionEvent ev) { | |
if (getCurrentFocus() != null) { | |
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); | |
if (imm != null) { | |
imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); | |
} | |
} | |
return super.dispatchTouchEvent(ev); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment