Search code examples
androidviewandroid-input-methodwindow-soft-input-mode

Why does softkeyboard continue to display in View?


I am trying to remove the code that launches the soft keyboard when an Activity loads the View. I removed 'android:windowSoftInputMode="stateVisible|adjustResize"' in the Manifest file. I then searched for any references to uses of InputMethodManager in the Activity. There is nothing in the layout file that I can see that would trigger loading of the soft keyboard. I then cleaned project and did a rebuild of it. The soft keyboard still loads when then View is created. I must be missing something. Any thoughts on why the soft keyboard would continue to load?


Solution

  • You should start with trying to set android:windowSoftInputMode="stateHidden|adjustResize"

    if it does not work, you may need to add the following some where in your code

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