Code example for Window

Methods: getAttributes, setAttributes

0
		// ÏÔʾ͸Ã÷µÄ¶Ô»°¿ò 
		 
		AlertDialog alertDialog = new AlertDialog.Builder(this)
				.setMessage("͸Ã÷¶Ô»°¿ò").setPositiveButton("È·¶¨", null).create();
		Window window = alertDialog.getWindow();
		WindowManager.LayoutParams lp = window.getAttributes();
		//  ÉèÖÃ͸Ã÷¶ÈΪ0.7 
		lp.alpha = 0.7f;
		window.setAttributes(lp);
		alertDialog.show();
  
		// ÏÔʾ·Ç͸Ã÷µÄ¶Ô»°¿ò 
		alertDialog = new AlertDialog.Builder(this).setMessage("Ôڵ׶ËÏÔʾ¶Ô»°¿ò")
				.setPositiveButton("È·¶¨", null).create();
		window = alertDialog.getWindow(); 
		 
		window.setGravity(Gravity.BOTTOM);
		alertDialog.show();
	} 
}