Skip to content

SoftInputKeyboard

qiibeta edited this page Oct 27, 2019 · 2 revisions

Android framework has three soft input policies: SOFT_INPUT_ADJUST_RESIZE, SOFT_INPUT_ADJUST_PAN, SOFT_INPUT_ADJUST_NOTHING

  • Scene container Activity's AndroidManifest.xml android:windowSoftInputMode must be set to adjustPan or adjustResize or adjustNothing,
  • adjustUnspecified flag has bug will cause requireActivity().getWindow().setSoftInputMode not working, then system will pick the best one depending on the contents of the window
  • If you push a AppCompatScene, everything will work fine, if you push a GroupScene, you should set root view's android:fitsSystemWindows to true,
  • otherwise SOFT_INPUT_ADJUST_RESIZE will have problem
requireActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
requireActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
requireActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING);