/**
	 * 设置Dialog窗体的大小
	 */
	private void setWindowSize() {
		DisplayMetrics dm = new DisplayMetrics();
		WindowManager m = getWindowManager();
		m.getDefaultDisplay().getMetrics(dm);
		// 为获取屏幕宽、高
		WindowManager.LayoutParams p = getWindow().getAttributes(); // 获取对话框当前的參数值
		// p.height = (int) (d.getHeight() * 1.0); //高度设置为屏幕的1.0
		p.width = (int) (dm.widthPixels * 0.86); // 宽度设置为屏幕的0.85
		p.alpha = 1.0f; // 设置本身透明度
		p.dimAmount = 0.6f; // 设置黑暗度
		getWindow().setAttributes(p);
	}

相关文章:

  • 2022-12-23
  • 2022-01-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-29
  • 2021-09-29
  • 2021-09-24
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-06
  • 2022-12-23
  • 2021-07-09
  • 2022-01-16
  • 2022-12-23
相关资源
相似解决方案