Dismiss Keyboard

null

If you’ve ever programmed an app that requires user input, and let’s face it, practically all do unless of course you’ve got an app that simply relies on the user to tap a button to effect some change, make a selection, or measure some data – or your app doesn’t have any user interaction…

But for the rest of the apps we make the user is expected to enter information, quite often from a keyboard. The problem with this, from a design perspective, is that the keyboard takes up quite a bit of real estate in the activity window (or storyboard) and while it is opened it hides the UI elements which are behind it.

So there are several ways to dismiss the keyboard in Android. The default way is for the user to click a green arrow icon on the soft keyboard after inputting their information. This shuts down the keyboard and then the rest of the layout and elements are accessible. Another way is to have the keyboard dismissed after a button is pressed. A third way is to have the keyboard shut down when the user clicks outside of the keyboard – I prefer this method as it seems to be more intuitive, flexible, and user-friendly.

A great resource I used to add this code to my project is found here.

Hope this helps you as you make Android apps that are user-enjoyable as well as user-friendly!

Leave a Reply

Your email address will not be published. Required fields are marked *