How to hide keyboard by default and show only when click on EditText
This question already has an answer here:
try this.
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
answer_et.postDelayed(new Runnable() {
@Override
public void run() {
InputMethodManager imm = (InputMethodManager)getSystemService(
Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(edit_text.getWindowToken(), 0);
}
}, 100);
}
sometime edittext get focus after manually hide soft-keyboard.
so, delay 100 mSeconds and then after hide it forcefully in onResume() method.
链接地址: http://www.djcxy.com/p/16604.html上一篇: Android在btn点击隐藏键盘