Android popupwindow 软件盘冲突

PopupWindow含有输入框时,点击输入框,软键盘可能会挡住PopupWindow,而咱们但愿的是软键盘可以把PopupWindow给顶上去。java

开始在网上查了很多资料,都没有一个能解决个人问题,因而本身动手多试了几个设置,误打误撞,把问题解决了。spa

 

[java] view plaincopyprint?.net

  1. popupWindow.setBackgroundDrawable(new BitmapDrawable());  orm

  2. popupWindow.setFocusable(true);  blog

  3. popupWindow.setSoftInputMode(PopupWindow.INPUT_METHOD_NEEDED);  get

  4. popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);  it

  5. popupWindow.showAtLocation(parent, Gravity.BOTTOM, 00);  io


这里说明一下,主要是设置map

popupWindow.setSoftInputMode(PopupWindow.INPUT_METHOD_NEEDED);margin

popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

这两句,并且顺序不能反,若是反过来就没效果了。

相关文章
相关标签/搜索