When my Activity with a ScrollView
layout and EditText
s starts, the EditText
s get focus and the Android OnScreen keyboard opens.
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"
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.
You can use below statement also,
(EditTextName).setInputType(0)
it will permanently hides default keyboard of perticular Edittext, even on EditText Touch or Click.
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);
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.