安卓—自定义alert弹出窗口

时间:2022-07-02 18:37:16

 默认用法

public void alertDialog(View view) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("弹出窗");
        builder.setMessage("提示信息!");
        builder.setPositiveButton("确认", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                System.out.println("确认执行函数");
            }
        }).setNegativeButton("取消", null);
        builder.show();
    }