16

I have a PopupWindow that is shown when a user is typing in an EditText. This popup offers him some suggestions. My problem is that when the Popup is shown, a part of it is displayed over the Keyboard on the screen, preventing the user to continue typing. Does anyone know why of this behaviour and how could I fix it?

Da2da2
  • 57
  • 2
  • 3
  • 13
pane619
  • 243
  • 3
  • 11
  • can you post the PopupWindow code? – C.d. Mar 05 '12 at 12:11
  • It's normal behavior of popup. Where should it be? There may be no space at all above keyboard (on small screens) – Jin35 Mar 05 '12 at 12:25
  • Yeah, the position of the popup on the screen is correct, but I want to have the keyboard always in front, not covered by the popup. For example, looking at the behaviour of AutoCompleteView, the dropdown view doesn't cover the virtual keyboard. I wanted to achieve that same result. – pane619 Mar 05 '12 at 23:39

4 Answers4

13

To have your popupwindow behind the softkeyboard just set this line:

popupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);

and also

popupWindow.setFocusable(false);
popupWindow.setOutsideTouchable(false);
Chetna
  • 864
  • 8
  • 26
2
popupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);

This is working with lollipop

Aram
  • 952
  • 1
  • 8
  • 30
1

try this

popupWindow = new PopupWindow(popupView, WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT,true);
0

try using

PopupWindow.showAtLocation(View parent, int gravity, int x, int y)

instead of

PopupWindow.showAsDropDown (View anchor)

Just TFS
  • 4,697
  • 1
  • 18
  • 22
Srikanth Goli
  • 159
  • 1
  • 3