走在安卓路上的菜鸟 2016-10-21 01:48 采纳率: 33.3%
浏览 853
已结题

android edittext与软键盘

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);
    //关闭软键盘,开启方法相同,这个方法是切换开启与关闭状态的
    }
    }

        调用这个方法,没有显示软键盘时时弹起,有显示时隐藏
    
    评论

报告相同问题?