读书人

PopupWindow弹出之后如何点击外面取

发布时间: 2012-12-29 10:28:09 作者: rapoo

PopupWindow弹出之后,怎么点击外面取消不了
PopupWindow myMenu = new PopupWindow(menuView, LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT,true);
myMenu.setOutsideTouchable(true);
myMenu.setBackgroundDrawable(new BitmapDrawable());
myMenu.setTouchable(true);
myMenu.setFocusable(true);
myMenu.update();

怎么定义的PopupWindow怎么点击返回键可以取消, 但是点击外部取消不了???


高手给我看下 谢谢
[解决办法]
http://www.cnblogs.com/joey-home/archive/2012/07/02/2573855.html
[解决办法]

引用:
引用:http://www.cnblogs.com/joey-home/archive/2012/07/02/2573855.html

非常感谢你,但是我的popupwindow是覆盖了整个屏幕,设置背景和setoutside(true)之后就不好使了,知道原因?

原来一直没用过popwindow。。一直是用dialog或者activity的android:style/Theme.Dialog
帮不了你啦。
[解决办法]
希望能帮的上你
PopupWindow pw;
LayoutInflater inflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.weight_popup, (ViewGroup)findViewById(R.id.linlay_weight_popup));
pw = new PopupWindow(layout,LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT, true);
pw.setBackgroundDrawable(new BitmapDrawable());
pw.setOutsideTouchable(true);
pw.showAsDropDown(btnSelectWeight);

读书人网 >Android

热点推荐