2012-11-17 109 views
1

我已經從XML一個變量:關閉Android鍵盤上開始

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

當應用程序加載鍵盤時顯示,但我想隱藏它,並且如果用戶想要返回它,她必須單擊EditText字段來顯示它。

回答

2
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); 
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); 
+0

酷感謝:-) – Solo

+0

不要忘了接受的答案。 –

0

這應該工作:

InputMethodManager inputManager = 
      (InputMethodManager) context. 
       getSystemService(Context.INPUT_METHOD_SERVICE); 
    inputManager.hideSoftInputFromWindow(
      this.getCurrentFocus().getWindowToken(), 
      InputMethodManager.HIDE_NOT_ALWAYS);