Chinaunix

标题: Hide keyboard [打印本页]

作者: luotootu    时间: 2011-12-22 08:53
标题: Hide keyboard
//This can be used to suppress the keyboard until the user actually touched the edittext view.

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

// It works.
t.setInputType(InputType.TYPE_NULL);

// It doesn't work, seems a bug
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(t.getWindowToken(), 0);





欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2