3

我正在使用带有渐变背景的 AlertDialog,但我遇到了边框问题,正如您在图像上看到的那样,边框显示非常糟糕。有什么办法可以摆脱它们吗?

在此处输入图像描述

我的警报对话框

public class MyAlertDialog extends AlertDialog { 
public MyAlertDialog(Context context,int theme)
{  
    super(context,theme);
    getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
}  

}

在一个活动中:

MyAlertDialog myDialog = new MyAlertDialog(ActionShowActivity.this,R.style.Theme_CustomDialog);   
MyAlertDialog.setMessage("text");
MyAlertDialog.show();

Theme_CustomDialog 的整个样式文件:

<?xml version="1.0" encoding="utf-8"?>
<resources>
   <style name="Theme" parent="android:Theme.Dialog">
</style>
<style name="Theme.CustomDialog">

  <item name="android:layout_width">wrap_content</item>
  <item name="android:layout_height">wrap_content</item>
  <item name="android:windowIsFloating">true</item>
  <item name="android:adjustViewBounds">true</item>
  <item name="android:background">@drawable/gradient_blue</item>
  <item name="android:windowFrame">@null</item>
  <item name="android:windowContentOverlay">@null</item>
  <item name="android:windowBackground">@color/transparent</item>



</style>
</resources>

我究竟做错了什么?为什么还有边界?

4

0 回答 0