I have my own keypad in my application so I want to hide the software keyboard all the time(in specific activities & dialogs).
I experimented with two options:
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
This code prevent the keyboard from popping up at the beginning, but when I click on the textbox the keyboard still pops.
InputMethodManager imm = (InputMethodManager)getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
This code hide the keyboard, but it doesn't prevent the keyboard from popping up.
PLEASE HELP!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…