Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keep android view in visible area if keyboard comes up

Tags:

android

I created a simple login screen that stacks a login button, the username and password edit boxes vertically from the bottom.

When someone clicks the username/password fields, the virtual keyboard comes up and hids the editbox or button below it. I have seen this in another application that the login button always stays in the visible area.... how can I achieve this?

like image 771
Sven Haiges Avatar asked Jul 13 '10 21:07

Sven Haiges


2 Answers

In your <activity> element of the AndroidManifest.xml use android:windowSoftInputMode="adjustResize":

<activity android:name=".YourActivity"
          android:windowSoftInputMode="adjustResize">
</activity>

Make sure you have wrapped the content of your layout into a ScrollView, so that it will be easily browsable.

like image 200
Cristian Avatar answered Oct 10 '22 04:10

Cristian


There's a blog post for that: http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html

like image 27
yanchenko Avatar answered Oct 10 '22 06:10

yanchenko