在Android应用程序中,我向用户显示一个没有按钮,只有消息的AlertDialog。如何以编程方式销毁AlertDialog,使其不再可见?我尝试使用cancel()和dismiss(),但它们都不起作用,视图仍然存在。
在Android应用程序中,我向用户显示一个没有按钮,只有消息的AlertDialog。如何以编程方式销毁AlertDialog,使其不再可见?我尝试使用cancel()和dismiss(),但它们都不起作用,视图仍然存在。
AlertDialog.Builder test = new AlertDialog.Builder(context);
test.setTitle("title");
test.setCancelable(true);
test.setMessage("message...");
test.create().show();
然后我尝试了
test.show().cancel()
和
test.show().dismiss()
但是它没有生效。