📜  关闭包含布局的对话框的代码 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:49.156000             🧑  作者: Mango

代码示例1
AlertDialog.Builder builder = new AlertDialog.Builder(this);

    LayoutInflater inflater = getLayoutInflater();
    View dialogView = inflater.inflate(R.layout.brush_opts_dialog,null);

    builder.setView(dialogView);


    closeBtn = (Button)dialogView.findViewById(R.id.close_btn);


   final AlertDialog dialog = builder.create();

    closeBtn .setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    dialog.show();