Hiding the android keyboard for EditText

前端 未结 10 2029
慢半拍i
慢半拍i 2020-12-17 14:27

Whenever I click in the EditText the Android keyboard popup window appears, but I don\'t want the keyboard to pop up.

I want to permanently hide the and

10条回答
  •  隐瞒了意图╮
    2020-12-17 15:07

    Solution can be found here :

    public void onCreate(Bundle savedInstanceState) {
    
    edittext = (EditText) findViewById(R.id.EditText01);
    
    edittext.setOnEditorActionListener(new OnEditorActionListener() {
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
             if (event != null&& (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
                InputMethodManager in = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                in.hideSoftInputFromWindow(edittext.getApplicationWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS);
             }
             return false;
          }
       });
    }
    

提交回复
热议问题