AlertDialog 怎么设置弹出框的宽高

自定义了一个AlertDialog 但是怎么也设置不了宽高
我是这样设置的View signView = LayoutInflater.from(this).inflate(R.layout.onemap_sign,null);
dialog = new AlertDialog.Builder(this).setView(signView).create();
WindowManager.LayoutParams params = dialog.getWindow().getAttributes();
WindowManager m = getWindowManager();
Display d = m.getDefaultDisplay(); //为获取屏幕
params.width = d.getWidth();
params.height = d.getHeight();
dialog.getWindow().setAttributes(params);
或者
dialog.getWindow().setLayout(ConstraintLayout.LayoutParams.WRAP_CONTENT, ConstraintLayout.LayoutParams.WRAP_CONTENT);
dialog.show();
以上的设置没起作用
谁有其他的办法设置AlertDialog的宽高

静态设置宽高,可以在布局R.layout.onemap_sign 里面最上面的布局设置你想要的宽高 ,动态的话你的代码里面setAttribues和setLayout原理应该是一样的,然后show方法要放在设置宽高前面,你可以试一下