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

2023-09-05 03:40:34 作者:發財

我试图用图像文本和按钮自定义 AlertDialog 创建。当我展示它,我得到一个白色边框看起来太可怕了。

I'm trying to create custom AlertDialog with an image text and buttons. When I display it I get a white border which looks horrible.

如何才能摆脱那种白色边框的?

How can I get rid of that white border?

下面我的自定义对话框:

Here my custom Dialog:

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();

    }

正如你所看到的topborder和形象有一个空间在2-3个像素。

As you can see the topborder and image have a space in 2-3 px.

推荐答案

试试这个用对话代替AlertDialog.Builder的

try this use Dialog Instead of AlertDialog.Builder

..从对话框删除边框线。

.. for remove border line from Dialog..

Dialog dialog = new Dialog(this,android.R.style.Theme_Translucent_NoTitleBar);
 
精彩推荐
图片推荐