是否可以在拨号盘外关闭xml对话框?
这是我的代码:
Dialog dialog;
public void my_dialog() {
final Context context = this;
//final Dialog dialog = new Dialog(context); // Intern
dialog = new Dialog(context);
dialog.setContentView(R.layout.my_xml_dialog);
final TextView txt_close = (TextView) dialog.findViewById(R.id.textView_txt_close);
txt_close.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss(); // works
}
});
dialog.show();
}
但是如果我尝试关闭对话框外的对话框,它就不起作用
dialog.dismiss();