Move layouts up when soft keyboard is shown? Move layouts up when soft keyboard is shown? android android

Move layouts up when soft keyboard is shown?


Yes, check out this article on the Android developers' site which describes how the framework handles the soft keyboard appearing.

The android:windowSoftInputMode attribute can be used to specify what happens on a per-activity basis: whether the layout is resized or whether it scrolls etc.


You can also use this code in onCreate() method:

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);


Add in AndroidManifest.xml for your activity:

android:windowSoftInputMode="adjustPan|adjustResize"