OnScreen keyboard opens automatically when Activity starts
Solution 1:
Android opens the OnScreenKeyboard automatically if you have an EditText
focussed when the Activity starts.
You can prevent that by adding following into your Activity's onCreate
method.
getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Solution 2:
If you want to do it editing the AndroidManifest:
<activity
android:name=".Dades"
android:label="@string/app_name"
android:windowSoftInputMode="stateHidden">
the line android:windowSoftInputMode="stateHidden"
is the one that prevents the keyboard focus.
Solution 3:
Another way is by adding on LinearLayout:
android:focusable="true"
android:focusableInTouchMode="true"
Let me indicate that
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
still does the same thing, but the cursor is still there.
Solution 4:
This will an inappropriate behaviour
getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
but it will do it smoothly(do it in manifest
for that activity)
android:windowSoftInputMode="stateHidden"