SoftKeyboard problem with Tabhost on bottom of screen

Many people (including myself) have encountered the problem of having an activity with a Tabhost aligned at the bottom of screen instead of its top.

What happens when you have an EditText or any other input method!
A soft keyboard will appear and push your TabHost above itself.

What's the solution for this? Turns out to be simple!


The cause of this problem is the android:windowSoftInputMethod property of your activity's tag in the manifest file.

To solve it use android:windowSoftInputMode="adjustPan|adjustResize".
Now your tabs will not float above the keyboard when an input starts.

This is really simple and does not need any further explanation. Whenever you decide to use a Tabbed Activity and you place your tabs on the bottom of the screen, use this code to disable the floating behavior.
Ba bye

10 comments: