android edittext什么条件下可以自己拉起软键盘?在没有设置软键盘弹出的情况下
3条回答 默认 最新
haha我逗 2016-10-21 01:49关注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);
//关闭软键盘,开启方法相同,这个方法是切换开启与关闭状态的
}
}调用这个方法,没有显示软键盘时时弹起,有显示时隐藏解决 无用评论 打赏 举报