Developer Tip: Managing the Android Soft Keyboard

The Android soft keyboard will display when an input field, such as textField, is in focus (e.g. a finger touch in the textField is sensed by the device). Normally, this is the behavior we want.

However, what if the first screen of your app is a login screen? Then we may not want the keyboard to launch as it may obscure information on the screen that we want the user to see before logging in.

Android Keyboard

In this case, the reason the keyboard launches immediately is because in the screen above, the textField is the first focusable field on the screen and that is where the focus will be.

If we want to keep the soft keyboard hidden, then we can set the windowSoftInputMode property of the Window to Titanium.UI.Android.SOFT_INPUT_STATE_HIDDEN as follows:

'Window[platform=android]': {
    windowSoftInputMode: Titanium.UI.Android.SOFT_INPUT_STATE_HIDDEN

Then we will get the desired behavior.

Android Keyboard 2


    • Basically Android show a keyboard by default when an application screen contains a textField. It is not convenient for the login page.

      • 63ek – correct but it also applies to other types of screens like a form with an input field on top. Really anytime the user is presented with a keyboard and you don’t want it displayed by default

    • Harrington, on device or in simulator? Did it work before you set this property? You can always revert by removing the property setting.

Comments are closed.