I'm currently designing simple tips popups using the PopupWindow class. I'm able to dismiss the popup when clicked outside of the content. However the touch events outside are consumed by the underlining layout. How can I consume the outside touches so that when clicked outside I still have the popup dismissed but there are no touch events being sent to the layout below my PopupWindow?
Current set properties:
mPopupWindow.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.popup_bg));
mPopupWindow.setOutsideTouchable(true);
Turns out there is a way to do it! After looking deep into PopupWindow and ListPopupWindow I discovered the option setFocusable(true); will do exactly what I needed!
If you are using ListPopupWindow then setModal(true)
will do the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With