Android|Android 设置Dialog 全屏

final Dialog dlg = new Dialog(this, R.style.dialog); dlg.setCanceledOnTouchOutside(true); dlg.show(); Window window = dlg.getWindow(); window.setWindowAnimations(R.style.dialog); window.setContentView(R.layout.dlg_application_attendance_guide); window.setBackgroundDrawable(new BitmapDrawable()); //设置alterdialog全屏 WindowManager windowManager = getWindowManager(); Display display = windowManager.getDefaultDisplay(); WindowManager.LayoutParams lp = dlg.getWindow().getAttributes(); lp.height = (int)(display.getHeight()); //设置宽度 lp.width = (int)(display.getWidth()); //设置宽度 dlg.getWindow().setAttributes(lp); View bgLayout = window.findViewById(R.id.layout_guide); bgLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { new_sign.setVisibility(View.VISIBLE); dlg.dismiss(); } });

    推荐阅读