How to disable android keyboard in android application

This question already has an answer here:

  • Close/hide the Android Soft Keyboard 69 answers

  • Try

    editText.setInputType(EditorInfo.TYPE_NULL)
    

    Or

    ((EditText) findViewById(R.id.LoginNameEditText)).setFocusable(false);
    

    Or

    editText.setKeyListener(null);
    

    尝试这个 :

    InputMethodManager imm =(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);
    

    try below code:-

        EditText ed = (EditText)findViewById(R.id.editText1);
    
        InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);  
        imm.hideSoftInputFromWindow(ed.getWindowToken(), 0);  
    
        ed.setOnClickListener(new OnClickListener() {
    
            public void onClick(View v) {
                // TODO Auto-generated method stub
                InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);  
                imm.showSoftInput(ed, InputMethodManager.SHOW_IMPLICIT);  
    
            }
        });
    

    or

    Window.SetSoftInputMode (SoftInput.StateAlwaysHidden);
    
    链接地址: http://www.djcxy.com/p/16614.html

    上一篇: 按钮点击时不显示android软键盘

    下一篇: 如何在android应用程序中禁用android键盘