分享一个让dialog背景透明的简单方法,代码如下:
Dialog dialog = new Dialog(context);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.dialog_view);
//dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);//去掉这句话,背景会变暗
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));