点击显示popupWindow背景切换透明,popupWindow消失背景恢复

点击显示popupWindow背景切换透明,popupWindow消失背景恢复


private void bgAlpha(float bgAlpha) {

WindowManager.LayoutParams lp = getWindow().getAttributes();

lp.alpha = bgAlpha;//0.0-1.0

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);

getWindow().setAttributes(lp);


点击显示popupWindow时调用

bgAlpha(0.5f);


popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {

@Override

    public void onDismiss() {

bgAlpha(1f);

    }

});


你可能感兴趣的:(点击显示popupWindow背景切换透明,popupWindow消失背景恢复)