// 产生背景变暗效果
WindowManager.LayoutParams lp = ((Activity)mContext).getWindow().getAttributes();
lp.alpha =0.4f;
((Activity)mContext).getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
((Activity)mContext).getWindow().setAttributes(lp);
//恢复透明度
WindowManager.LayoutParams lp = ((Activity)mContext).getWindow().getAttributes();
lp.alpha =1f;
((Activity)mContext).getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
((Activity)mContext).getWindow().setAttributes(lp);
网友评论