How to hide keyboard by default and show only when click on EditText

This question already has an answer here:

  • Close/hide the Android Soft Keyboard 69 answers

  • try this.

    @Override
    protected void onResume() {
        // TODO Auto-generated method stub
        super.onResume();
    
        answer_et.postDelayed(new Runnable() {
        @Override
        public void run() {
            InputMethodManager imm = (InputMethodManager)getSystemService(
            Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(edit_text.getWindowToken(), 0);
            }
        }, 100);
    
    }
    

    sometime edittext get focus after manually hide soft-keyboard.

    so, delay 100 mSeconds and then after hide it forcefully in onResume() method.

    链接地址: http://www.djcxy.com/p/16604.html

    上一篇: Android在btn点击隐藏键盘

    下一篇: 如何隐藏键盘默认情况下,只有点击EditText时才显示