草庐IT

myPopupWindow

全部标签

android - 触摸外部时关闭弹出窗口

我想在触摸外部时关闭PopupWindow,我从这个SO问题中得到了答案。hereisthatLink这里他们要求包含这两行代码。myPopupWindow.setBackgroundDrawable(newBitmapDrawable());myPopupWindow.setOutsideTouchable(true);现在,当我在PopupWindow之外触摸时,Popup消失了。单独使用setOutsideTouchable(true);是行不通的。当我设置背景Drawable时,它​​正在工作。这种魔法是如何发生的?谁能解释一下?此外,newBitmapDrawable()已弃