enunciator/notification bar conflicting with a custom view?
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 开发者_StackOverflow社区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?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();
}
精彩评论