您的位置:首页 > 移动开发 > Android开发

android EditText 自动获取焦点并弹出软键盘

2016-04-15 12:13 417 查看
话不多说,直接上代码!

EditText e;
e=(EditText)findViewById(R.id.editText);
//获取焦点
e.setFocusable(true);
e.setFocusableInTouchMode(true);
e.requestFocus();
//打开软键盘
InputMethodManager imm = (InputMethodManager)e.getContext()
.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: