// 点击空白关闭popupWindow
//过时
myPopupWindow.setBackgroundDrawable(newBitmapDrawable());
//用一张小图片替代
myPopupWindow.setBackgroundDrawable(
new BitmapDrawable(getApplicationContext().getResources(), Bitmap.createBitmap(1, 1,Bitmap.Config.ARGB_8888) ));
I just use a background-color that I wantto set to the PopupWindow. So for example,
oneof my PopupWindows just had a few Images without margins in between them,
soI just used a Transparent background for it:
myPopupWindow.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
And for another one I wanted to use a whitebackground anyway, so I've used:
//用一张白色的图片替代
myPopupWindow.setBackgroundDrawable(newColorDrawable(android.graphics.Color.WHITE));