Android 4.2 adjustPan

100 views Asked by At

I need help, I have been searching for hours a solution to this problem without success... I have an EditText inside a ViewGroup, when I click on this editText the virtual keyboard is shown. The problem is that on Android 4.2+ devices everything works as expected, the edittext is pushed up. On pre 4.2 devices the edittext stays behind the keyboard.

I have tried this on the manifest file but nothing change:

<activity
  ...
  android:windowSoftInputMode="adjustPan"> //or adjustResize
</activity>

Why is this happening and how can I fix it? Thank you!

1

There are 1 answers

1
AggieDev On

To solve this, use this for your editText:

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