EditText自动获取焦点并弹出输入法

 

// 获取编辑框焦点
editText.setFocusable(true);
//打开软键盘
InputMethodManager imm = (InputMethodManager) ctx
.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
 
//关闭软键盘
imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
posted @ 2013-07-22 22:40  xxdc  阅读(266)  评论(0编辑  收藏  举报