How to hide softkeyboad when activity start in android?
Solution 1
In your AndroidManifest.xml
:
<activity android:name="com.your.package.ActivityName"
android:windowSoftInputMode="stateHidden" />
More details about windowSoftInputMode
can be found here.
This setting will hide soft keyboard when user enters new Activity (even if EditText control gains the focus). Soft keyboard will be shown only when user clicks the edit box control.
Solution 2
You can hide keyboard by add two lines to the parent view of editText.
android:focusable="true"
android:focusableInTouchMode="true"
Urvashi
Updated on April 19, 2020Comments
-
Urvashi about 4 years
I have android app in which one layout contains
Linearlayout
,ScrollView
,TextView
,EditView
andButton
. when I call from one activity to other this activity call and setlayout
which I have describe.I would like to know when activity call there is by default
EditView
selected. and open thesoftkeyboard
. I don't want to open that keyboard when activity start. but I want to open thatsoftkeyboard
on touch event ofEditView
.How can I do that?
-
PFranchise over 9 yearsAs a follow-up that might be useful for some, you can also do the following (in the event you were already using another
android:windowSoftInputMode
:android:windowSoftInputMode="adjustPan|stateHidden"