1. 程式人生 > >懸浮view覆蓋狀態列

懸浮view覆蓋狀態列

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;