如何在自定义AlertDialog中删除边框?

Pet*_*ter 2 android android-alertdialog

我正在尝试AlertDialog使用图像文本和按钮创建自定义.当我显示它时,我得到一个看起来很可怕的白色边框.

在此输入图像描述

我该如何摆脱那个白色边框?

这是我的自定义对话框:

public LinearLayout customeLL;
    public void  alertD()
    {
        AlertDialog ad;
        AlertDialog.Builder  builder;
        Context mContext = getApplicationContext();
        TextView a = new TextView(getApplicationContext());
        a.setText("Test dialog");
        ImageView img = new ImageView(getApplicationContext());
        img.setBackgroundResource(R.drawable.bottombar_bg);
        LinearLayout customeLL = new LinearLayout(getApplicationContext());
        customeLL.setOrientation(LinearLayout.VERTICAL);
        customeLL.addView(img,curWidth,37);
        customeLL.addView(a,curWidth,37);
        builder = new AlertDialog.Builder(myClass.this);
        builder.setView(customeLL);
        ad=builder.create();
        ad.show();

    }
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,topborder和图像的空间为2-3 px.

Nir*_*tel 9

尝试使用Dialog而不是AlertDialog.Builder

..用于从Dialog中删除边框线..

Dialog dialog = new Dialog(this,android.R.style.Theme_Translucent_NoTitleBar);
Run Code Online (Sandbox Code Playgroud)