Skip to content

Instantly share code, notes, and snippets.

@lbrenman
Created July 24, 2016 11:18
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save lbrenman/a736aa8da1794b39a5c3af05b06764f6 to your computer and use it in GitHub Desktop.

Developer Tip for 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.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment