PopupWindow - Dismiss when clicked outside
I found that none of the answers supplied worked for me, except WareNinja's comment on the accepted answer, and Marcin S.'s will probably also work. Here's the part that works for me:
myPopupWindow.setBackgroundDrawable(new BitmapDrawable());
myPopupWindow.setOutsideTouchable(true);
Alternatively:
myPopupWindow.setFocusable(true);
Not sure what the differences are, but the ListPopupWindow source code actually uses the latter when it's modality is set to true with setModal, so at least the Android developers consider this a viable approach, and it's only one line.
Please try to set setBackgroundDrawable
on PopupWindow
that should close the window if you touch outside of it.