开发者

How to close AlertDialog with a mouse click?

I have an AlertDialog with a short information about my application and I would like to close it without any buttons, just with a mouse click somewhere on my Alert开发者_开发知识库Dialog. Is it possible to do that?


You can use

mAlertDialog.setCanceledOnTouchOutside(true);

Using this if you click outside the dialog it will get dismissed.


Maintain the reference to AlertDialog and on mouse click, call mAlertDialog.dismiss() to dismiss the dialog.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜