用dialog做弹窗的宽度占满屏幕:
//新建联系人 dialog实现
public void showAddContactPersonDialog(){
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
//获取布局
View view = View.inflate(getActivity(), R.layout.dialog_document_add_person, null);
//获取布局中的控件
edPopName = (EditText) view.findViewById(R.id.et_nickname);
edPopId = (EditText) view.findViewById(R.id.et_id);
TextView tvSave = (TextView) view.findViewById(R.id.tv_save);
TextView tvCancel = (TextView) view.findViewById(R.id.tv_cancel);
// 设置参数
builder.setView(view);
//创建对话框
AlertDialog alertDialog = builder.create();
alertDialog.show();
Window dialogWindow = alertDialog.getWindow();
//一定要加 宽度铺满屏幕宽度 设置背景色
dialogWindow.setBackgroundDrawableResource(R.color.transparent);
//获取屏幕宽、高
WindowManager windowManager = getActivity().getWindowM