(一)自定义dialog宽度全屏细节注意点

1

···

.AlertDialog.Builder dialog =new AlertDialog.Builder(UnbindBankCardActivity.this, R.style.Dialog_FS);

View view = View.inflate(UnbindBankCardActivity.this, R.layout.view_chakanshilitupian_alertdialog, null);

final AlertDialog alertDialog = dialog.create();alertDialog.setView(view);

alertDialog.show();

/** * 设置dialog宽度全屏 */

WindowManager m = getWindowManager();Display d = m.getDefaultDisplay(); //为获取屏幕宽、高android.view.WindowManager.LayoutParams params = alertDialog.getWindow().getAttributes(); //获取对话框当前的参数值、

params.width = (int) (d.getWidth()); //宽度设置全屏宽度alertDialog.getWindow().setAttributes(params);

···

//设置生效注意!!!!!!!!!!!以上设置并不能使dialog全屏,还要将dialog的style这样改将原来的

···

···

你可能感兴趣的:((一)自定义dialog宽度全屏细节注意点)