Android---解决PopupWindow无法覆盖状态栏

当sdk > 21,PopupWindow在标题栏没有办法遮罩
有两种方法:
方法1:

popupWindow.setClippingEnabled(false);

方法2:

      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            try {
                Field mLayoutInScreen = PopupWindow.class.getDeclaredField("mLayoutInScreen");
                mLayoutInScreen.setAccessible(true);
                mLayoutInScreen.set(popupWindow, true);
            } catch (NoSuchFieldException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }

你可能感兴趣的:(Android---解决PopupWindow无法覆盖状态栏)