-4

I have a simple question. I'm creating a game which players have to set their nick names in EditText. When I start an intent to the activity in which they have to put their names in, the Keyboard pops up, like this:

This is my EditText:

 <EditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="Enter Nickname"
    android:textColorHint="@android:color/white"
    android:id="@+id/etNickName"
    android:layout_below="@+id/imageView9"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true" />   

Is there any way that the keyboard will not pop up right away when the activity starts?

Sabin Chacko
  • 713
  • 6
  • 17

2 Answers2

1

just write this in you Manifest file

<activity
        android:name=".YourActivity"
        android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
xbadal
  • 1,284
  • 2
  • 11
  • 24
0

Set android:focusableInTouchMode="true" to your root layout

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/blue_dark"
        android:focusableInTouchMode="true"
        android:orientation="vertical">
        .
        .
        .
    </RelativeLayout>
Komal12
  • 3,340
  • 4
  • 16
  • 25