Other [quiz] What happens to the device screen size?

Erel

B4X founder
Staff member
Licensed User
Longtime User
Code:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   If 100%x > 100%y Then Log("Landscape") Else Log("Portrait")
   Dim lv As LayoutValues = GetDeviceLayoutValues
   Log(lv & ", size = " & lv.ApproximateScreenSize)
End Sub

Output:

Landscape
1794 x 1080, scale = 3.0 (480 dpi), size = 4.3625
** Activity (main) Resume **

Portrait
1080 x 1776, scale = 3.0 (480 dpi), size = 4.33
** Activity (main) Resume **

Why is device screen size larger in landscape mode?

Tested on Nexus 5 (it will not happen on all devices).
 

eurojam

Well-Known Member
Licensed User
Longtime User
I assume that the pixels used by the navbar are excluded. If you change the orientation of the nexus 5 you can observe, that the navbar in landscape is a little bit smaller then in portrait, this should be the difference of 18pixel.

stefan
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I assume that the pixels used by the navbar are excluded. If you change the orientation of the nexus 5 you can observe, that the navbar in landscape is a little bit smaller then in portrait, this should be the difference of 18pixel.

stefan
That's the correct answer.

You can see it in this screenshot:

SS-2015-07-12_12.36.46.png

The left screenshot is from a landscape device (the image is rotated).

The soft buttons bar is shorter in landscape orientation.
 
Upvote 0
Top