如何从AlertDialog构建器中删除黑色边框

And*_*Dev 4 android

实际上我已经使用AlertDialog.builder创建了一个自定义对话框.在这个对话框中我没有显示titile.All工作正常,但对话框中出现黑色边框.所以任何人都可以告诉我如何删除这个黑色的boder.代码和截图如下.

java中的代码:

        AlertDialog.Builder start_dialog = new AlertDialog.Builder(this);

        Context mContext = getApplicationContext();
        LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
        View layout = inflater.inflate(R.layout.custom_dialog2,
                                       (ViewGroup) findViewById(R.id.layout_root));

        layout.setBackgroundResource(R.drawable.img_layover_welcome_bg);

        Button btnPositiveError = (Button)layout.findViewById(R.id.btn_error_positive);   
        btnPositiveError.setTypeface(m_facedesc);

        start_dialog.setView(layout);

        final AlertDialog alert = start_dialog.create();
        alert.show();

        btnPositiveError.setOnClickListener(new Button.OnClickListener()
        {
            public void onClick(View v) 
            {
                alert.dismiss();
            }
        });
Run Code Online (Sandbox Code Playgroud)

ScrrenShot

在此输入图像描述

小智 7

Without creating a custom background drawable and adding a special style just add
Run Code Online (Sandbox Code Playgroud)

你的代码一行:

dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
Run Code Online (Sandbox Code Playgroud)

关于对话框的更多信息:

Dilaogs