EditTexts, keyboards and the mystery of nonmovement…

I’ve done some cool stuff with my mapmaking routines for my game, on which I’ll post later (screenshots included, of course … it’s really starting to resemble what I am aiming for!).

 

But in the meantime, let me tell you about Android EditTexts.

I have an EditText in a FrameLayout. The ET is placed to the bottom of the screen using layout_gravity=”bottom”. Which is all well and good, but when I tap the ET, I want the IME/softkeyboard to come up. Which it does … but it overlaps the keyboard. Which isn’t good 😦

I spent a day or so trying to get the screen to “pan and scan” or whatever using

android:windowSoftInputMode=”stateHidden|adjustPan”

in the activity’s tags in the Manifest, all to no avail. adjustResize didn’t work, wrapping things in a ScrollView didn’t work … every time the keyboard came up, it just hid what was underneath it.

In the end, the solution was relatively simple, although it’s implications aren’t as nice: what was going on was that I had set my application to fullscreen; no Titlebar, no statusbar. I’d also set

getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

to make use of the extra layout space.

After disabling that and just showing the statusbar, lo and behold! My EditText now will move up when the keyboard appears.

Nice waste of a day 😦 I hope this post helps others not waste that time!

 

Advertisements
This entry was posted in android, programming and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s