android 4.0 Dialog gets canceled when touched outside of dialog window

大憨熊 提交于 2019-11-27 20:24:11

Check this method from the Android Developers site for dialog.

Try using the

dialog.setCanceledOnTouchOutside (boolean cancel)

Pass a boolean value to enable/disable dialog behaviour when touched outside of the dialog window.

Also go through these links:

How do I fire an event when click occurs outside a dialog

How to cancel an Dialog themed like Activity when touched outside the window?

I hope this answers your question.

You may use

dialog.setCancelable(true/false);

OR

dialog.setCanceledOnTouchOutside(true/false);

For the latest vesrions of Android;

It will disable outSideTouching event.

dialog.setCancelable(false)

Dialog CAN NOT cancel when touch out side OR press BACK key

dialog.setCanceledOnTouchOutside(false)

Dialog CAN NOT cancel when touched outside BUT ABLE to canceled when press BACK key

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!