1

My Android application has to, at some point, switch to landscape mode with no enunciator bar to display a screen that takes up the full display hight and width. I do this by calling

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE)

and by calling "setFlags" on the Window object passing in "WindowManager.LayoutParams.FLAG_FULLSCREEN"

When I return to portrait mode and recover the enunciator bar using setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)

and setting the flag "WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN" and "WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR".

My layout object's origin (0,0) is now under the enunciator. So the first 15 or so pixels of my application view are covered over by the enunciator/cell signal/battery bar.

Has anyone else seen this problem?
Is there a flag that I'm missing that will recover portrait/non-fullscreen without pushing my application up into the top bar?

Stefan
  • 5,203
  • 8
  • 27
  • 51
haseman
  • 11,213
  • 8
  • 41
  • 38

1 Answers1

0

Just find a solution from this previous post Hiding Title in a Fullscreen mode?

private void updateFullscreenStatus(bUseFullscreen)
{   
   if(bUseFullscreen)
   {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
    }
    else
    {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }

    m_contentView.requestLayout();
}
Community
  • 1
  • 1
papachan
  • 1,891
  • 17
  • 20