Android: How do I prevent the soft keyboard from pushing my view up?

后端 未结 28 1628
南笙
南笙 2020-11-22 05:10

I have a vertical sliding drawer at the bottom of my app. When the soft keyboard opens, it pushes the tab for the drawer up, so it sits atop the keyboard. I actually want it

28条回答
  •  情话喂你
    2020-11-22 06:01

    There are two ways of solving this problem. Go to the AndroidManifist.xml, and in the name of your activity, add this line

       android:windowSoftInputMode="adjustPan"
    

    As in the below code, I have added to the Register Activity.

     
    

    In the second way, go to your activity, and in your onCreate method, add this code.

    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
    

提交回复
热议问题