Different States of Soft Keyboard In Android Programming

To provide the best user experience, you should understand these different Keyboard states

Sung Park
Sketchware
3 min readMay 4, 2017

--

The Android system shows an on-screen keyboard — known as a soft input method — when a text field in your UI receives focus. The keyboard takes about half the screen; in other words, you only have half of the screen to display any information. Utilizing this space could be very useful if you have any important content to show, but sometimes it could be more convenient to display the keyboard automatically — it all depends on the UX.

Today, we’ll talk about Sketchware’s new Keyboard visibility feature in 1.3 version update!

What you’ll need

  1. Sketchware — a mobile IDE on your smartphone
  2. Passion for learning! :-)

What you’ll learn

  1. Keyboard Visibility feature in Sketchware

Why was “Keyboard Visibility” feature added?

EditText is primarily used for taking user input in Android Programming, and when it is focused, it forces the keyboard to pop up. Before the 1.3 update in Sketchware, EditText was automatically focused, and the keyboard was forced to pop up when EditText was present in the activity (even if the EditText was disabled). We saw this as an issue for apps that would initially start with disabled EditText since keyboard popped up even if the user was unable to input anything into it. This would limit the developers from providing different user experiences; some may want to start the application with the keyboard hidden or automatically visible by default.

How do I implement it?

When you open the View Manager in Sketchware, you can find the Keyboard State options in the bottom. There are three options available:

1. Unspecified (default)— The state of the soft keyboard (whether it is hidden or visible) is not specified. The system will choose an appropriate state or rely on the setting in the theme. This is the default setting for the behavior of the soft keyboard.

2. Visible — The soft keyboard is visible when that’s normally appropriate (when the user is navigating forward to the activity’s main window).

3. Hidden — The soft keyboard is hidden when the user chooses the activity — that is, when the user affirmatively navigates forward to the activity, rather than backs into it because of leaving another activity.

Android Developer Documentation

Conclusion

We’ve talked about different Keyboard States in Android Programming. Sketchware’s new 1.3 version allows you to force the visibility of on-screen keyboards, so you can provide different UX depending on your situation.

That’s it. Happy coding! :-)

If you enjoyed this article, please press the 💚 below so others can find this article too!

--

--