Hide Android navigation/status bar

Hello,

How i hide navigation/status bar in my android game?

I’m using Cocos Creator with JavaScript. Is there any solution using only JavaScript? Or i will need implement an android Java class?

Thanks

I’ll check with colleagues to see if there’re API to do this.

You can try

cc.view.enableAutoFullScreen(true);

But some browser may not respond to it, then you can’t change the way browser wants.

I have this same problem.

Before I installed SDKBox and adMob I was building against earlier android SDK. After installing SDKBox I had to install android sdk 15. since then im getting a status bar in my game when building out to android. How do I stop this?

Hi,
I solved it with an android implementation in my Activity:

public class AppActivity extends Cocos2dxActivity {
    ...
    private Cocos2dxGLSurfaceView glSurfaceView;
    ...

@Override
public Cocos2dxGLSurfaceView onCreateView() {
    glSurfaceView = new Cocos2dxGLSurfaceView(this);
	...
}

//Hide status and navigation bar
@Override
public void onWindowFocusChanged(boolean hasFocus)
{
    super.onWindowFocusChanged(hasFocus);
    if (hasFocus)
    {
        this.hideSystemUI();
    }
}
private void hideSystemUI()
{
    // Set the IMMERSIVE flag.
    // Set the content to appear under the system bars so that the content
    // doesn't resize when the system bars hide and show.
    glSurfaceView.setSystemUiVisibility(
            Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_LAYOUT_STABLE 
            | Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
            | Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
            | Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
//end
...
}