10

Does anyone know the replacement for the adjust resize flag in Android 11? My layout has the EditText and it's getting hidden after the keyboard popup as I can't use the below the flag

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

Thanks

Bruno
  • 3,872
  • 4
  • 20
  • 37
ketan muttha
  • 296
  • 2
  • 7
  • Hi! Any progress? – Lobs May 06 '21 at 20:57
  • Have you tried this? [How to adjust dialog layout when soft keyboard appears using the latest WindowInset API](https://stackoverflow.com/questions/64947700/how-to-adjust-dialog-layout-when-soft-keyboard-appears-using-the-latest-windowin) – Daniel Cettour Sep 21 '21 at 14:48

1 Answers1

0

Can you please try the following? I think you should add padding at the bottom of your view. The size of the padding should be the height of the keyboard.

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
    getActivity().getWindow().setDecorFitsSystemWindows(false);

    getActivity().getWindow().getDecorView().setOnApplyWindowInsetsListener((v, insets) -> {
        int height = insets.getInsets(WindowInsets.Type.ime()).bottom;
        v.setPadding(0, 0, 0, height);
        return insets;
    });
}