1、设置背景透明
dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
2、设置背景透明+显示居中
dialog.setContentView(inflate);// 把布局设置给dialog
Window dialogWindow = dialog.getWindow();
dialogWindow.setBackgroundDrawableResource(android.R.color.transparent);// 一句话搞定
WindowManager.LayoutParams lp = dialogWindow.getAttributes();
dialogWindow.setGravity(Gravity.BOTTOM|Gravity.LEFT);
lp.y = 150; // 新位置Y坐标
lp.width = (int) getResources().getDisplayMetrics().widthPixels; // 宽度
//lp.width = 650;
dialogWindow.setAttributes(lp);