2

I have a fullscreen activity and setting it to full screen by the following code

private void setFullScreenFocus() {
    getWindow().getDecorView()
            .setSystemUiVisibility(
                    View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                            | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
                            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}

I have implemented a pop up window dialog but when it is shown it makes the status bar and nav bar visible. How to avoid that?

Below is the popupwindow code

PopupWindow seasonEpisodePopUpWindow;
LayoutInflater inflater = (LayoutInflater) anchorView.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    if (seasonEpisodeView == null)
        seasonEpisodeView = inflater.inflate(R.layout.player_seasons_episode_list, null);
if (!seasonEpisodePopUpWindow.isShowing()) {
            seasonEpisodePopUpWindow.showAtLocation(anchorView, Gravity.BOTTOM, viewLocation[0], height);
            appCMSPlayVideoFragment.setPreviousNextVisibility(false);
        }
WISHY
  • 11,067
  • 25
  • 105
  • 197

1 Answers1

0

For me, the problem has been occurring only on Android 5.0 and only when a popup window was a full screen window. I found a following workaround, instead of:

mPopupWindow.setWidth(WindowManager.LayoutParams.MATCH_PARENT);
mPopupWindow.setHeight(WindowManager.LayoutParams.MATCH_PARENT);

i wrote:

DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
mPopupWindow.setWidth(displayMetrics.widthPixels);
mPopupWindow.setHeight(displayMetrics.heightPixels);

and it surprisingly worked.