Forums

OverviewV-Play 2 Support (Qt 5)Android Fullscreen support › Reply To: Android Fullscreen support

OverviewV-Play 2 Support (Qt 5)Android Fullscreen support › Reply To: Android Fullscreen support
#8998

Caeser

no wait but the game over screen is fully full screen so it must be an issue with my layout settings. i will look into this myself, thanks.

 

here is a snippet to use to add immersive layout in your app or game.

 

1. look for QtActivity.java

for example under C:\Qt\Qt5.2.0_android\5.2.0-rc1\android_armv7\src\android\java\src\org\qtproject\qt5\android\bindings\QtActivity.java

2. copy this line of code.

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
  if (hasFocus) {
    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);
  }
}

3. look for the onWindowFocusChanged method in the QtActivity.java

4. Paste the above code in the method, example

@Override
public void onWindowFocusChanged(boolean hasFocus) {
  if (!QtApplication.invokeDelegate(hasFocus).invoked)
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      if (hasFocus) {
      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);
    }
  }
  super.onWindowFocusChanged(hasFocus);
}

5. Save the file and run your game on devices Kitkat and above.

I upvote this feature for v-play.

Thanks

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support