Nav Bar Height (without extensions!)

According to android developers:

the standard height of the navigation bar is 48dp in portrait mode and 42dp for the width when placed vertically in landscape mode on tablets.

Is there any way to confirm this without using extensions? Is this a "close enough is good enough" value?

With extensions I find 46dp.

I need to get the full height of the screen.

Can be done by looking up the actual resolution of the device, but would prefer to do things from within the app.

It would be ugly from a user point of view, but you could hide the title bar and then show it again and compute the difference in height of the Screen, I think.

Is the Title bar the same height as the nav bar then ? Gives me 56dp.

Hmm, Screen.Height doesn't change if the StatusBar or ActionBar are hidden.

No.

Correct, but you can use a VA in fill parent instead to get the StatusBar Height

which for me gives a statusbar height of 46dp

but this doesn't help in getting the nav bar height, unless we assume 48dp.

In my case 820 + 46 + 48 = 914

As I had already shown in my blocks.

Yes, some interesting numbers there.

Pixel 7 Pro, Android 16

See topic title!

Navbar height before Android 12 = 48 dp and on Android 12+ = 24 dp.

I am not seeing that on my Pixel 8a Android 17. My NavBar has the usual 3 icons :red_square: :red_circle: :red_triangle_pointed_up: , not gestures.

I know the native resolution of the device is 2400x1080
I know the density is 2.625

thus the "AppInventor" screen height = 2400/2.625 = 914 pixels

take off Screen Height of 820 pixels and Statusbar of 46 pixels leaves me...

48 pixels for the NavBar.

Hmm, interesting. I have three Pixel devices (running Android 11, 13, and 16). The navigation bar height is 48 dp on A11, and 24 dp on both A13 and A16. So, an extension is needed to query the correct height.

While it might theoretically be possible to do this without an extension, it would hardly make sense within an app to use a timer to temporarily show and hide the system bars.

I am all ears... :ear: :ear:

Since AI2—unlike Niotron and Kodular—lacks a method for hiding the navbar, it would likely be virtually impossible to calculate the correct navbar height without an extension unless the actual screen height is known. It would be worth investigating whether the screen height could potentially be retrieved from an online database.

However, it is odd that AI2 allows the ActionBar and StatusBar to be hidden, but not the Navbar.

1 Like