Search code examples
androidcocos2d-x

How to hide navigation bar on android


I need to enable full screen mode without navigation bar on android which placed in the bootom of the screen. (Like on clash of clans game). I don't know how can I do this in cocos2dx. Kindly suggest.


Solution

  • if your question about android then that is the answer

    public class FullScreen extends Activity {
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
    
            setContentView(R.layout.main);
        }
    }
    

    if you want full screen For window (Ex: web view .....)

    int width = [[NSScreen mainScreen] frame].size.width;
    int height = [[NSScreen mainScreen] frame].size.height;
    
    [yourWindow setFrame:NSMakeRect(0, 0, width, height) display:YES];
    

    You can refer to some tutorial teach you how make your window full screen

    tutorial-making-your-mac-app-support-full-screen-in-1-minute.html

    ios-7-tutorial-series-gestures-and-fullscreen-layouts

    https://www.youtube.com/watch?v=Bb2ywxOnFZE