gpt4 book ai didi

android - 如何删除自定义 AlertDialog 中的边框?

转载 作者:太空狗 更新时间:2023-10-29 15:39:43 34 4
gpt4 key购买 nike

我正在尝试创建带有图像文本和按钮的自定义 AlertDialog。当我显示它时,我得到一个看起来很糟糕的白色边框。

enter image description here

我怎样才能去掉那个白色边框?

这是我的自定义对话框:

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 px 的空间。

最佳答案

尝试使用 Dialog 而不是 AlertDialog.Builder

.. 用于从对话框中删除边框线..

Dialog dialog = new Dialog(this,android.R.style.Theme_Translucent_NoTitleBar);

关于android - 如何删除自定义 AlertDialog 中的边框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5910239/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com