版权声明:本文为博主原创文章。未经博主同意不得转载。
https://blog.csdn.net/mingyue_1128/article/details/32316069
一、键盘不消失,popuwindow在下层布局大小不变
popupWindow=new PopupWindow(popuview,LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
// 须要设置一下此參数。点击外边可消失
popupWindow.setBackgroundDrawable(new BitmapDrawable());
//设置点击窗体外边窗体消失
popupWindow.setOutsideTouchable(true);
//设置弹出窗体须要软键盘,
popupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
//再设置模式,和Activity的一样。覆盖。
popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
二、键盘不消失,popuWindow在下层,布局上移
popupWindow=new PopupWindow(popuview,LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
// 须要设置一下此參数,点击外边可消失
popupWindow.setBackgroundDrawable(new BitmapDrawable());
//设置点击窗体外边窗体消失
popupWindow.setOutsideTouchable(true);
//设置弹出窗体须要软键盘,
popupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
//再设置模式,和Activity的一样,覆盖,调整大小。
popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
三、键盘消失
popupWindow=new PopupWindow(popuview,LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
// 须要设置一下此參数,点击外边可消失
popupWindow.setBackgroundDrawable(new BitmapDrawable());
//设置点击窗体外边窗体消失
popupWindow.setOutsideTouchable(true);
popupWindow.setFocusable(true);