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