Soft keyboard covers an EditText in a PopupWindow

时光怂恿深爱的人放手 提交于 2019-12-03 01:47:02

For anyone stumbling upon this in the future, I ended up just using a Dialog instead of a PopupWindow, and panning to keep the EditText in view works fine on 2.2 with a Dialog.

There is simpler way. Just provide alternative layout for active keyboard.

  1. Left click on project select: "Android tools/New Resource File..." .
  2. Chose layout, give file name "main" (don't worry about conflicts).
  3. Click "next". Then on list on the left select "keyboard" and move it to right (click "->").
  4. On right side select keyboard state.
  5. Click finish.
  6. Now copy content of your main.xml located in "res/layout" to new file in res/layout-keyssoft".
  7. Correct new layout in such way that keyboard is not in that way. Remember to maintain same "id"s for respective components in those two layouts (that is why copy paste was needed).
  8. Enjoy how it works

Read about configuration changes to understand how it works. Note that EVERY configuration change (orientation change, language change, ...) will cause recreation of Activity (in such case argument of onCreate is not null) so you can provide different layouts for different cases.

MKJParekh

I doubt the problem is because of using that ScrollView in XML,

There has been another problem similar to this, You can check all different answers there, and may work for you.

Rahulkapil

change this

android:windowSoftInputMode="stateUnspecified|adjustPan"

to

android:windowSoftInputMode="adjustPan"

only in your manifest file

Tai Tran

You should change

android:windowSoftInputMode="stateUnspecified|adjustPan 

to

android:windowSoftInputMode="stateHidden|adjustPan"
kontashi35

It took couple of hours to figure out and I ended up using scrollview.

Apparently there is no way to overcome this problem when you use popup window and soft input keypad hide your view. Just go for Scroll View.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!