开发者

How to close AlertDialog with a mouse click?

开发者 https://www.devze.com 2023-02-20 01:42 出处:网络
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 possib

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

精彩评论

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

关注公众号