How to dismiss a DialogFragment when pressing outside the dialog?

前端 未结 8 629
盖世英雄少女心
盖世英雄少女心 2020-12-04 17:05

I am using a DialogFragment, and while I have successfully set an image to close (i.e. dismiss) the dialog when pressed, I am having a hard time finding the way

8条回答
  •  孤城傲影
    2020-12-04 17:43

    I would recommend to use my solution only after trying out above solutions. I have described my solution here. Just to brief, I am checking touch bounds of DialogFragment.getView(). When touch points are outside DialogFragment, I am dismissing the Dialog.

提交回复
热议问题