Search code examples
androiddialogdestroy

Destroy DialogActivity by clicking besides it


I have an activity in my project, which is shown as a DialogActivity by this entry in the manifest:

<activity android:name=".ActivityDialog" android:theme="@android:style/Theme.Dialog">    </activity>

The Activity doesn't overlay the whole screen, so my question is:

Is it possible to destroy this DialogActivity by clicking besides it? So as it is possible at a normal Dialog?

Thanks!


Solution

  • Theme.Dialog sets some padding so it does not overlay the whole screen . if you are interested in destroy the dialog on click at this boundary area , set a touch listener to parent layout , compare X,y with appropriate number so ensure thats its desired region .