Dialog with custom view, setCanceledOnTouchOutside doesn't work

后端 未结 2 2097
遇见更好的自我
遇见更好的自我 2021-01-07 04:15

am using a Dialog with a custom view. That view\'s layout is 300dp x 300dp is size and centered on the screen. Now i want it to be dismissed when the user touches outside th

2条回答
  •  不知归路
    2021-01-07 04:57

    It might be a tad late but for those who are still looking for the answer, here it is.

    Apply a custom style to your dialog. In your style, include this:

    true
    

    Otherwise the dialog will use full screen. Hence no outside area to click to cancel. This works for dialogs with custom content.

    Example:

    
    

    Hope this helps.

提交回复
热议问题