android edittext什么条件下可以自己拉起软键盘?在没有设置软键盘弹出的情况下
public static void InputMethod(Context context) {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
//得到InputMethodManager的实例
if (imm.isActive()) {
//如果开启
imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS);
//关闭软键盘,开启方法相同,这个方法是切换开启与关闭状态的
}
}
调用这个方法,没有显示软键盘时时弹起,有显示时隐藏
当你获取焦点的时候,它就会自动弹出软键盘的了