Android: Close dialog window on touch
问题 I'd like to close a dialog window in my android app by simply touching the screen.. is this possible? If so, how? I've looked into setting some "onClickEven" on the dialog, but it doesnt exist. How would this be possible? 回答1: You can use dialog.setCanceledOnTouchOutside(true); which will close the dialog if you touch u=outside the dialog. 回答2: If your dialog contains any view try to get the touch events in that view and dismiss your dialog when user touch on that view. For example if your