Question

I have a fullscreen project, and am hiding the statusbar using

        getWindow ().setFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);

in the main activity's onCreate.

This works, and hides the status bar just fine, until I add a YoutubeFragment and play a video. The moment the video loads, the status bar drops down, very annoying. I tried setting the flags all over the onInitializationSuccess listener, but no dice. The documentation doesn't mention the status bar on any non-full screen layout changes at all: https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubePlayerFragment

Anyone any ideas?

Thanks in advance.

Was it helpful?

Solution 2

I was using a android 4.4.2 device to test with. With 4.1+ or higher there's another way to hide the status bar dynamically : http://developer.android.com/training/system-ui/status.html#41

    //4.1+ Specific hiding of status bar

    View decorView = getWindow().getDecorView();
    int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
    decorView.setSystemUiVisibility(uiOptions);

I do not have the problem with the status bar popping up when adding a YoutubeFragment. Why the old code didn't work with YoutubeFragments, or even setting the Theme to

 android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen"

, I have no idea though.

OTHER TIPS

I don't know if you can put in manifest to hide action bar.

But try this function of Activity class

getActionBar().hide();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top