Skip to content Skip to sidebar Skip to footer

How To Hide The Softkeyboard?

I've an activity that displays a view. The view consists of various widgets, one of which is a multiline EditText. When the view is inflated the softkeyboard comes up how can i dis

Solution 1:

Add this to your manifest file

  android:windowSoftInputMode="stateHidden"

as

<activity android:name=".youractivity"
              android:windowSoftInputMode="stateHidden"

    </activity>

Solution 2:

Hide it by :

editText.setInputType(InputType.TYPE_NULL);

and when you need to show it use :

editText.setInputType(InputType.TYPE_CLASS_TEXT);
editText.requestFocus();
InputMethodManagermgr= (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.showSoftInput(editText, InputMethodManager.SHOW_FORCED);

Solution 3:

android:descendantFocusability="beforeDescendants"
 android:focusableInTouchMode="true"

add this two lines at top view

ex:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:descendantFocusability="beforeDescendants" <-----
    android:focusableInTouchMode="true" > <-----
    ....
    EditText
    .....
    </RelativeLayout>

Solution 4:

When just u go on your apps manifest.xml then write for this code.

<activityandroid:name="yourActName"android:configChanges="keyboardHidden" ></activity>

Post a Comment for "How To Hide The Softkeyboard?"