如何在自定义AlertDialog删除边框? [英] How to remove border in custom AlertDialog?

查看:112
本文介绍了如何在自定义AlertDialog删除边框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用图像文本和按钮自定义 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);

这篇关于如何在自定义AlertDialog删除边框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆