在片段中显示弹出窗口会使活动不遵循`FLAG_FULLSCREEN`

时间:2015-12-23 06:38:48

标签: android popup android-fullscreen

我在我的活动的onCreate中使用以下代码使其隐藏状态栏以及主页,后退和菜单按钮栏。

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().setFlags(
            WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
                    | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
            WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
                    | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

此活动有一个片段,我需要在其中显示一个弹出窗口。弹出窗口时,活动将从全屏幕退出,显示状态栏以及主页和后退按钮。这是显示弹出窗口的代码。

    LinearLayout viewGroup = (LinearLayout) rv.findViewById(R.id.popup);
    LayoutInflater layoutInflater = (LayoutInflater) getActivity()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View layout = layoutInflater.inflate(R.layout.popup_layout, viewGroup);

    // Creating the PopupWindow
    final PopupWindow popup = new PopupWindow(getActivity());
    popup.setContentView(layout);
    popup.setWindowLayoutMode(
            ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    popup.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
    popup.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
    popup.setFocusable(true);

如何强制FLAG_FULLSCREEN ??

0 个答案:

没有答案