问题:测试时弹窗点击空白区域有的手机不消失;
解决方法:
//转化为popunwindow
final PopupWindow mPopupWindow= new PopupWindow(xuanz_popunwindwow,
LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
//设置下面的四行就可以了
mPopupWindow.setBackgroundDrawable(new BitmapDrawable());
mPopupWindow.setFocusable(true);
mPopupWindow.setOutsideTouchable(true);
mPopupWindow.update();
//设置各个控件的点击响应
userPopWindow.setContentView(contentView);
userPopWindow.showAtLocation(view,Gravity.CENTER, 0, 0);
注:上面的那四行要写在ShowAtLocation之前,否则会被父控件view拦截
更多好内容戳下面: