设置popwindow显示后添加屏幕的背景透明度

2017-02-15 By CodeArt 0

pop.showAtLocation(getActivity().findViewById(R.id.framelayout), Gravity.BOTTOM, 0, 0);
                    //设置透明度
                  backgroundAlpha(0.6f);

/**
 * 设置添加屏幕的背景透明度

  • @param bgAlpha
     */

public void backgroundAlpha(float bgAlpha){
 WindowManager.LayoutParams lp =getActivity().getWindow().getAttributes();
lp.alpha = bgAlpha; //0.0-1.0
  getActivity().getWindow().setAttributes(lp);
}