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?
Asked
Active
Viewed 50 times
1 Answers
1
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);

Derek Fung
- 8,171
- 1
- 25
- 28
-
I don't understand. Why would the default be that the keyboard loads and then I have to insert code to hide it or turn it off. I thought the default is no soft keyboard and then you have to enable it with stateVisible or showSoftInput. – AJW Sep 14 '15 at 04:28
-
whenever a EditText get focus, the default is a keyboard will be shown. If your have `
` set, it requestFocus for you when the layout is loaded – Derek Fung Sep 14 '15 at 04:29 -
because your default focus is going on someEditable fields ? try to `requestFocuse()` on Non Editable Fields such as `TextView` – N J Sep 14 '15 at 04:30
-
All of the EditText fields are to accept user input. I want to show the View first without the keyboard and then when the user clicks or touches the first EditText the code should launch the keyboard. – AJW Sep 14 '15 at 04:32
-
I know, so you should try the suggestion I made. Or you simply should not `requestFocus` – Derek Fung Sep 14 '15 at 04:34
-
Minor problem. The View is not matching the parent layout. The View size is still assuming there is a keyboard being shown so the View is only using about 60% of the top-to-bottom distance of the device screen. Any thoughts? – AJW Sep 14 '15 at 04:46
-
Try this ? `android:windowSoftInputMode="stateHidden|adjustResize"` – Derek Fung Sep 14 '15 at 04:49
-
More information would be required, screenshots, Activity and Fragment layout, code – Derek Fung Sep 14 '15 at 05:47