如何设置dialog背景全透明

1,296 阅读1分钟

如下

我们只需要把这句话放到dialog.show()前面即可

dialog.getWindow().setDimAmount(0);//设置背景昏暗度,0是全透明

设置DialogFragment的窗体背景色的方法

请在onCreateView方法中调用

//设置dialog背景色为透明色
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
//设置dialog窗体颜色透明
//getDialog().getWindow().setDimAmount(0);