1

I'm using android:windowSoftInputMode="adjustResize" on my activity to enable my view to get resize when the keyboard is shown. However, when dismiss the keyboard, we could see the resize of the view back to it's original state happens slow, reviewing the grey background for about 1 second.

Is there any way I could have this speed up? (e.g. perform the resize before the keyboard hide?)

Elye
  • 53,639
  • 54
  • 212
  • 474

2 Answers2

0

I have a workaround that handle this issue. Firstly, implement the custom layout (i.e. ContainerViewHandler as per the answer in the given link) that detects the keyboard as per https://stackoverflow.com/a/34779195/3286489.

On onKeyboardHide callback, set the softInputMode to Panning as below

@Override
public void onKeyboardHide() {
    getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
}

That will ensure the resizing back to it's original position happens before the keyboard hidden, then speed up the process.

Note: Remember also to set back to Resize Mode again right before the keyboard is reactivate.

Community
  • 1
  • 1
Elye
  • 53,639
  • 54
  • 212
  • 474
0

Depending on how is your layout setup, the problem may be related to image scaling when the layout is resized.

Eduardo Naveda
  • 1,880
  • 3
  • 15
  • 30