Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android on-screen keyboard auto popping up

People also ask

How do I stop my on-screen keyboard from automatically appearing?

Right-click (or long-press) on the taskbar, then select Taskbar settings to display the context menu. Under Taskbar corner icons, set Touch keyboard to Off.

How do I stop on-screen keyboard from popping?

To get there, open the Start menu and type “ease of access”. Press Enter when the Ease of Access Center option appears. From there, click “Use the computer without a mouse or keyboard.” Uncheck the “Use On-Screen Keyboard” checkbox.

Why does Samsung keyboard keep popping up?

Go to Settings>General Management>Language and Input. Go to Physical Keyboard. If your software keyboard keeps popping up, it's most likely because the "Show on-screen keyboard" toggle is on. Switch it off to stop the keyboard from popping up.


You can use the following line of code in the activity's onCreate method to make sure the keyboard only pops up when a user clicks into an EditText

this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); 

<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".Main"
              android:label="@string/app_name"
              android:windowSoftInputMode="stateHidden"
              >

This works for Android 3.0, 3.1, 3.2, 4.0 - Editor Used to Compile (Eclipse 3.7)

Place the 'windowSoftInputMode="stateHidden"' in your application's manifest XML file for EACH activity that you wish for the software keyboard to remain hidden in. This means the keyboard will not come up automatically and the user will have to 'click' on a text field to bring it up. I searched for almost an hour for something that worked so I thought I would share.


Add this in your AndroidManifest.xml :

android:windowSoftInputMode="stateHidden|adjustResize"

It works perfectly. :)


This code will work on all android versions:

@Override
 public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.activity_login);

 //Automatic popping up keyboard on start Activity

     getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);

 or

 //avoid automatically appear android keyboard when activity start
     getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
 }

Add this in parent layout of the XML.

android:focusable="true" 
android:focusableInTouchMode="true"

It ensures the focus isn't on the editText when the Activity starts.


You can use either this in the onCreate() method of the activity

this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); 

or paste this code in the Activity tags in AndroidManifest.xml

android:windowSoftInputMode="stateVisible"