自定义dialog布局
public Dialog createDialog(Context context) {
dialog = new Dialog(context, R.style.Theme_DataSheet);
inflater = LayoutInflater.from(context);
view = inflater.inflate(R.layout.dialog_picture_select, null);
view.findViewById(R.id.tv_1).setOnClickListener(this);
view.findViewById(R.id.tv_2).setOnClickListener(this);
Window window = dialog.getWindow();
// window.getDecorView().setPadding(0, 0, 0, 0);
WindowManager.LayoutParams lp = window.getAttributes();
// lp.width = WindowManager.LayoutParams.MATCH_PARENT;
// lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
lp.dimAmount = 0.2f;
lp.gravity = Gravity.BOTTOM;
dialog.onWindowAttributesChanged(lp);
dialog.setCanceledOnTouchOutside(true);
dialog.setContentView(view);
return dialog;
}