private void init(final Context context) {
View view = LayoutInflater.from(context).inflate(R.layout.bottom_dialog_layout, null);
setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
int height= ScreenUtils.getScreenHeight()*2/3;
setHeight(height);
setContentView(view);
initView(context, view);
setBackgroundDrawable(new ColorDrawable(0x00000000));
setOutsideTouchable(true);
setFocusable(true);
setAnimationStyle(R.style.PayPopupStyle);
setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss() {
WindowManager.LayoutParams param = ((Activity) context).getWindow().getAttributes();
param.alpha = 1f;
((Activity) context).getWindow().setAttributes(param);
}
});
}
@Override
public void showAtLocation(View parent, int gravity, int x, int y) {
super.showAtLocation(parent, gravity, x, y);
WindowManager.LayoutParams param = ((Activity) context).getWindow().getAttributes();
param.alpha = 0.7f;
((Activity) context).getWindow().setAttributes(param);
}
网友评论