I have following layout:
<LinearLayout
android:id="@+id/linearLayoutHolder"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:background="@android:color/white" >
<EditText android:id="@+id/edit_message"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="50dp"
android:inputType="textCapSentences"
android:background="@android:color/transparent"
android:hint="@string/edit_message"
android:textColorHint="@android:color/darker_gray"
android:windowSoftInputMode="stateHidden"/>
</LinearLayout>
This produces:

Now, when user presses the show background apps button at the bottom (as shown in above picture), and when user comes back to the app, the soft keyboard gets shown.

I don't want the soft keyboard to be shown in this case.
How can this be done?
In your AndroidManifest.xml, add the below attribute for the entry of this Activity:
android:windowSoftInputMode="stateHidden"
It is not supposed to be written in your layout XML, but the AndroidManifest.xml.
To set more than one soft input modes, you can set it like:
android:windowSoftInputMode="stateHidden|adjustResize"
For more information, you can refer the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With