Search code examples
c#android.netandroid-softkeyboard

Opening Keyboard From Side When In Landscape


I have an app in which the EditText(s) are laid out in a manner in which I want to keep them all visible while the user is typing. When in portrait orientation, this is very simple, because the height of the area simply decreases to accommodate the keyboard, since the keyboard opens from the bottom. However, when in landscape orientation, opening the keyboard from the bottom (which is where it normally does) would decrease the height so much that everything would overlap and/or not fit at all. The only appropriate design I could come up with would be to have the keyboard open from the side, which would allow everything to fit very nicely on the screen. Is there a way to open the keyboard from the side of the screen rather than the bottom? Thanks!


Solution

  • There's no way to do this. The Android framework only puts the keyboard at the bottom. It also has extract mode, where the keyboard becomes a full screen experience. But it's the keyboard app itself that gets to decide whether to use that or not, not the application you're typing into. Also, the size of the keyboard is decided by the keyboard app. So if the keyboard app wants to be full width, it gets full width, regardless of what your app wants. There are some games the keyboard itself can play to have floating keyboards above the app- but those have to be implemented by the keyboard app they use, they are not built into Android. And remember there is no single Android keyboard you can rely on being everywhere, OEMs can and do install whatever keyboard they want on the device.

    Nor would it be a good user experience if you could do what you want. Sure, you'd have all the data on screen. But someone who has their reflexes trained to type on a certain keyboard would have extreme difficulty typing on a smaller, shifted version of the keyboard. Your best option is to either let the user do what they want and use their keyboard as usual, or to lock the application into portrait mode only.