Resize android when keyboard appears

I would like to move the layout when the keyboard appears, for example, when editing a text field to get visibility in a focused field. I tried windowSoftInputMode, but I can not understand. How to reach it? Thanks.

<activity android:name="com.xxxx.projecte1.TabBar_Activity" android:theme="@android:style/Theme.NoTitleBar" android:configChanges="keyboardHidden|orientation|screenSize" android:windowSoftInputMode="adjustResize" /> 
+4
source share
3 answers

I believe the problem is this line

android:configChanges="keyboardHidden|orientation|screenSize"

in your code. This line tells Android that your Activity will handle these 3 events on its own. If you delete this line, I believe that you will have the desired effect.

See here for the configChanges attribute.

+1
source

For anyone with a similar problem:

What fixed in my case just put

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

into my onCreate method.

Without any xml changes, as this did not work for me at all, but it immediately worked like a charm. Although the xml solution seems more pleasant to me, even the same parameter does not work.

Separate it, since I did not find a quick and easy fix on the Internet.

+5
source
  <activity android:name="com.zib_bol.home.HomeActivity" android:configChanges="orientation|keyboard|keyboardHidden|screenSize|screenLayout|uiMode" android:icon="@drawable/navigation_two" android:label="@string/app_name" android:screenOrientation="portrait" android:theme="@style/MyTheme" android:windowSoftInputMode="adjustResize" /> 
+4
source

All Articles