Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/374.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 开始时关闭Android键盘_Java_Android - Fatal编程技术网

Java 开始时关闭Android键盘

Java 开始时关闭Android键盘,java,android,Java,Android,我有一个来自xml的变量: editTextInput=(EditText)findViewById(R.id.editTextInput) 当应用程序加载时,会显示键盘,但我想将其隐藏,如果用户想将其取回,则必须单击EditText字段以显示它。这应该可以: InputMethodManager inputManager = (InputMethodManager) context. getSystemService(Context.

我有一个来自xml的变量:

editTextInput=(EditText)findViewById(R.id.editTextInput)

当应用程序加载时,会显示键盘,但我想将其隐藏,如果用户想将其取回,则必须单击EditText字段以显示它。

这应该可以:

 InputMethodManager inputManager = 
            (InputMethodManager) context.
                getSystemService(Context.INPUT_METHOD_SERVICE); 
    inputManager.hideSoftInputFromWindow(
            this.getCurrentFocus().getWindowToken(),
            InputMethodManager.HIDE_NOT_ALWAYS); 
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);