popup window outside click set to false [setOutsideTouchable(false)] does not work

人走茶凉 提交于 2019-12-01 10:51:58
Rajesh Panchal

Try this:

pw.setTouchable(true);    
pw.setFocusable(false);    
pw.setOutsideTouchable(false);  

When window touchable is true, focusable is false, setOutsideTouchable() works.

If setOutsideTouchable(true), touch outside of popupwindow will dismiss, otherwise the outside of popupwindows still can be touchable without dismiss.

To dismiss the popup window just add the following line of code

  popupWindow.setBackgroundDrawable(new ColorDrawable());

It worked for me and i am sure this is what you want.

Try the below code. Its working for me

popUp.setOutsideTouchable(false);
popUp.setFocusable(true);
popUp.showAtLocation(this.layout, Gravity.CENTER, 0, 0);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!