Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Max screen size on Android whithout navigationbar dimension

Max screen size on Android whithout navigationbar dimension

Scheduled Pinned Locked Moved Solved Mobile and Embedded
4 Posts 3 Posters 1.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • PowerNowP Offline
    PowerNowP Offline
    PowerNow
    wrote on last edited by
    #1

    Hi,
    I'm just looking for a way to get the maximum size / resolution of the display of an android device where I hide the navigationbar via manifest.xml. The point is that the navigationbar is visible for the first seconds and Qml Screen or QScreen in C++ delivers the display size minus the dimension of the navigationbar. The result is that my app has to resize after the navigationbar disappears and this is disturbing. For me would be helpful either to find a way to get the full display size from beginning without the navigationbar or better to setup it directly propably in Java that the navigationbar is never visible.

    Does anyone has an idea?

    Thanks in advance...

    PowerNowP 1 Reply Last reply
    0
    • PowerNowP PowerNow

      Hi,
      I'm just looking for a way to get the maximum size / resolution of the display of an android device where I hide the navigationbar via manifest.xml. The point is that the navigationbar is visible for the first seconds and Qml Screen or QScreen in C++ delivers the display size minus the dimension of the navigationbar. The result is that my app has to resize after the navigationbar disappears and this is disturbing. For me would be helpful either to find a way to get the full display size from beginning without the navigationbar or better to setup it directly propably in Java that the navigationbar is never visible.

      Does anyone has an idea?

      Thanks in advance...

      PowerNowP Offline
      PowerNowP Offline
      PowerNow
      wrote on last edited by
      #2

      I found following solution, which is also recommended under https://developer.android.com/training/system-ui/immersive.html

      1.) Open in Qt directory the file QtActivity.java
      .....\Qt\Qt5.7.0\5.7\android_armv7\src\android\java\src\org\qtproject\qt5\android\bindings
      2.) Fill in

      public void onCreate(Bundle savedInstanceState)
          {
              super.onCreate(savedInstanceState);
              m_loader.APPLICATION_PARAMETERS = APPLICATION_PARAMETERS;
              m_loader.ENVIRONMENT_VARIABLES = ENVIRONMENT_VARIABLES;
              m_loader.QT_ANDROID_THEMES = QT_ANDROID_THEMES;
              m_loader.QT_ANDROID_DEFAULT_THEME = QT_ANDROID_DEFAULT_THEME;
              m_loader.onCreate(savedInstanceState);
      
      	//########################################################
      	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      		View decorView = getWindow().getDecorView();
      
      		int uiOptions = 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;
      
      		decorView.setSystemUiVisibility(uiOptions);	
      	}
      	//######################################################
          }
      

      and

      public void onWindowFocusChanged(boolean hasFocus)
          {
              if (!QtApplication.invokeDelegate(hasFocus).invoked) 
      	    super.onWindowFocusChanged(hasFocus);
      
      	    //##########################################################
      	    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      		if (hasFocus) {
      	        	View decorView = getWindow().getDecorView();
      
      			int uiOptions = 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;
      
      			decorView.setSystemUiVisibility(uiOptions);
      		}
        	    }
      	    //##################################################################
          }
      

      It works perfectly and hope to help someone...

      ekkescornerE 1 Reply Last reply
      3
      • PowerNowP PowerNow

        I found following solution, which is also recommended under https://developer.android.com/training/system-ui/immersive.html

        1.) Open in Qt directory the file QtActivity.java
        .....\Qt\Qt5.7.0\5.7\android_armv7\src\android\java\src\org\qtproject\qt5\android\bindings
        2.) Fill in

        public void onCreate(Bundle savedInstanceState)
            {
                super.onCreate(savedInstanceState);
                m_loader.APPLICATION_PARAMETERS = APPLICATION_PARAMETERS;
                m_loader.ENVIRONMENT_VARIABLES = ENVIRONMENT_VARIABLES;
                m_loader.QT_ANDROID_THEMES = QT_ANDROID_THEMES;
                m_loader.QT_ANDROID_DEFAULT_THEME = QT_ANDROID_DEFAULT_THEME;
                m_loader.onCreate(savedInstanceState);
        
        	//########################################################
        	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        		View decorView = getWindow().getDecorView();
        
        		int uiOptions = 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;
        
        		decorView.setSystemUiVisibility(uiOptions);	
        	}
        	//######################################################
            }
        

        and

        public void onWindowFocusChanged(boolean hasFocus)
            {
                if (!QtApplication.invokeDelegate(hasFocus).invoked) 
        	    super.onWindowFocusChanged(hasFocus);
        
        	    //##########################################################
        	    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        		if (hasFocus) {
        	        	View decorView = getWindow().getDecorView();
        
        			int uiOptions = 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;
        
        			decorView.setSystemUiVisibility(uiOptions);
        		}
          	    }
        	    //##################################################################
            }
        

        It works perfectly and hope to help someone...

        ekkescornerE Offline
        ekkescornerE Offline
        ekkescorner
        Qt Champions 2016
        wrote on last edited by
        #3

        @PowerNow thx letting us know
        @tero-kojo this kind of stuff should be collected at a central place (we discussed this last year ;-)

        ekke ... Qt Champion 2016 | 2024 ... mobile business apps
        5.15 --> 6.8 https://t1p.de/ekkeChecklist
        QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

        1 Reply Last reply
        1
        • tekojoT Offline
          tekojoT Offline
          tekojo
          wrote on last edited by
          #4

          @ekkescorner that's my "home" account for testing purposes.

          The wiki would be the right place as a start.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved