Android經過透明度設置背景變暗

變暗blog

WindowManager.LayoutParams lp=getWindow().getAttributes();
lp.alpha=0.3f;
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
getWindow().setAttributes(lp);

  

變爲原來的樣子get

WindowManager.LayoutParams lp=getWindow().getAttributes();
lp.alpha=1.0f;                  getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
getWindow().setAttributes(lp);
相關文章
相關標籤/搜索