[GUIDE]Make your Game Full Screen without status and navigation Bar!

Discussion in 'Buildbox General Discussion' started by nayamamarshe, Jun 15, 2016.

?

Did my Tutorial help you?

  1. Yeah! Thanks! I'll press the like button too!

    100.0%
  2. No, I need help!

    0 vote(s)
    0.0%
  1. nayamamarshe

    nayamamarshe Avid Boxer

    Joined:
    Feb 21, 2016
    Messages:
    237
    Likes Received:
    64
    Hi Boxers!
    This will be a simple and short tutorial to make your android game go fullscreen so that it hides status and navigation bar and you don't have problems of different screen sizes.

    EXAMPLE:
    [​IMG]
    Let's Start...

    1. Export your game from BB to android.
    2. Open Eclipse->File->Import and then select your exported game folder.
    3. Next up, Go to this Directory in your Project Explorer
    com.yourgamename.blahblah->src->org.cocos2dx.lib->Cocos2dxActivity.java
    Double click and open the .java file.
    [​IMG]

    4. Now search for this line of code in the editor.
    Code:
    setContentView(framelayout);
    HIGHLIGHTED IN THE IMAGE IS THE CODE YOU SHOULD LOOK FOR
    [​IMG]
    5. Now just above the line we found,
    Code:
    // Set framelayout as the content view[/COLOR]
            setContentView(framelayout);
    you need to paste this code.
    [​IMG]

    Code:
     getWindow().getDecorView().setSystemUiVisibility(
                    View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                            | View.SYSTEM_UI_FLAG_FULLSCREEN
                            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
    
    ONE LAST THING, You have done the code work. Now its time to import 'View' in your code. If you don't, android won't be able to understand what you entered the fullscreen code for.
    Its super simple. Just where you have entered the code for fullscreen, there are many View methods in it. Example : View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
    So just put your mouse over on View and a popup should come and select import View.

    OR
    -----------------------
    IF YOU HAVE ALREADY IMPORTED "VIEW" by using the popup, YOU DON'T NEED TO FOLLOW THIS METHOD
    -----------------------
    SCROLL TO THE TOP OF THE .java FILE and there you'll see many imported methods.
    Just in the middle, put this line

    Code:
    import android.view.View;
    
    And you're done.
    [​IMG]



    That's it! Your game will now be fullscreen!
    Hit like if my tutorial worked.
    Ask any question if got a problem.
     
    Last edited: Jun 15, 2016
    Christoph likes this.
  2. shadi3900

    shadi3900 Boxer

    Joined:
    Oct 14, 2016
    Messages:
    24
    Likes Received:
    3
    how can I do it with android studio?
     
  3. nayamamarshe

    nayamamarshe Avid Boxer

    Joined:
    Feb 21, 2016
    Messages:
    237
    Likes Received:
    64
  4. playsgames6666

    playsgames6666 Miniboss Boxer

    Joined:
    Nov 13, 2015
    Messages:
    1,168
    Likes Received:
    745
    i don't understand what all the need is for all this, every game i have made and run on android runs at full screen, without doing all this.
    Oh well,
     
    blad300 likes this.
  5. nayamamarshe

    nayamamarshe Avid Boxer

    Joined:
    Feb 21, 2016
    Messages:
    237
    Likes Received:
    64
    I don't think it runs on fullscreen. Have you tried playing your game on a phone with on-screen buttons? The whole game window shift upwards. If you haven't yet made your game fullscreen that would cause a bad impression on users.
     
  6. playsgames6666

    playsgames6666 Miniboss Boxer

    Joined:
    Nov 13, 2015
    Messages:
    1,168
    Likes Received:
    745
    of course i have tried, thats how i know it runs full screen.
     
  7. minibraun

    minibraun Boxer

    Joined:
    Dec 22, 2016
    Messages:
    13
    Likes Received:
    13
    Thank you nayamamarshe, it worked like a charm :) (and I was using android studio)
    It really bugged me that the default export had onscreen navigation. The BuildBox team should really add a checkbox for fullscreen android export or just make it default.
     

Share This Page