Categories: archive |code

Android: fixing window resizing and scrolling

Recently, when I was working on an my forthcoming Exercise Android App, I was having an issue. When I clicked into a EditText box, then the soft keyboard would come up. So far, so good. But what was happening was the keyboard was covering a good portion of the EditText box until the user began to type.

Basically, it looked like this:

Android Bad Scroll

Obviously, this wasn’t what I wanted. After scouring the Internet, I found out about the property android:windowSoftInputMode that you put into an application tag in your Manifest file. This has a few options. The ultimately correct one was adjustResize. However, that wasn’t the end of it.

Next, I needed to add an actual scrollable area, as a TableLayout is not scrollable by default. This was easy enough, as I surrounded my TableLayout with a ScrollView tag and gave it the property android:isScrollContainer="true".

This fixed my layout to look like this:

Android Good Scroll

Which was what I wanted. Good times.

View code here

Hopes this helps.