android 自定义dialog去掉白色背景

public class VipSuccessDialog extends Dialog {

    Context context;

    View view;

    public VipSuccessDialog(@NonNull Context context) {
        super(context,R.style.dialog_3);
        this.context = context;
        view = LayoutInflater.from(context).inflate(R.layout.vip_success_dialog,null);
        setContentView(view);
        setCanceledOnTouchOutside(false);
        getWindow().setBackgroundDrawableResource(android.R.color.transparent);//去掉白色背景

        initDialog();

    }

    private void initDialog() {
        TextView tv_submit = (TextView) view.findViewById(R.id.tv_submit);
        tv_submit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
    }


}

你可能感兴趣的:(android)