int titleBarHeight = ScreenUtil.getStatusBarHeight(mContext);
int titleHeight = ScreenUtil.dp2Px(mContext,44);
WindowManager.LayoutParams wmParams = new WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
titleBarHeight+titleHeight,
WindowManager.LayoutParams.TYPE_SYSTEM_ERROR,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_FULLSCREEN,
PixelFormat.TRANSLUCENT);
wmParams.gravity = Gravity.TOP | Gravity.LEFT;
wmParams.y = -titleBarHeight;
wmParams.x = 0;
我想要的效果是覆盖状态栏,点击屏幕可以跳转其他界面修改为以下:
int titleBarHeight = ScreenUtil.getStatusBarHeight(mContext);
int titleHeight = ScreenUtil.dp2Px(mContext,44);
int pushHeight = titleHeight+titleBarHeight;
WindowManager.LayoutParams wmParams = new WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
pushHeight,
WindowManager.LayoutParams.TYPE_SYSTEM_ERROR,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT);
wmParams.gravity = Gravity.TOP | Gravity.LEFT;
wmParams.y = -titleBarHeight;
wmParams.x = 0;