在你dialog.show();后面加上
alertDialog =new AlertDialog.Builder(this, R.style.DialogTheme)
.setView(getChoiceView(2), 0, 0, 0, 0)
.create();
alertDialog.getWindow().setGravity(Gravity.BOTTOM);
alertDialog.show();
WindowManager windowManager = getWindowManager();
Display display = windowManager.getDefaultDisplay();
WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();
lp.width = (int)(display.getWidth()); //设置宽度
dialog.getWindow().setAttributes(lp);
网友评论