Window Soft Input Mode ConstraintLayout

前端 未结 3 1475
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-04 02:12

Earlier there was no problem with soft input mode, but after including ConstraintLayout, content of fragment doesn\'t move up when the keyboard appears.

Man

3条回答
  •  日久生厌
    2021-02-04 02:31

    I encountered the same problem with you, we declared android:windowSoftInputMode="stateAlwaysHidden|adjustResize" in the AndroidManifest.xml, but in fact the App showed the results like adjustPan, the contents are gone on top of the soft keyboard. So I set adjustResize programmatically, successfully solved this problem:

    Just add this line to your onCreate:

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

提交回复
热议问题