Android Stop Edit Text From Gaining Focus When Activity Starts

In this tutorial I will show you how to make the edit text not gaining focus when the activity starts. Sometimes this auto-focus can be annoying because the keyboard shows up even if we do not want to write something into our edit text. But let’s see what should be done in order to get rid of this issue.

1. Into your project files search for the AndroidManifest.xml file.
2. Open the manifest and put the following code between the activity tag:

android:windowSoftInputMode="stateHidden"

And that’s all. Now the keyboard should not open automatically when your activity starts.

Menu