Android Question GetDeviceLayoutValues.ApproximateScreenSize VS ActivitySize

MarcoRome

Expert
Licensed User
Longtime User
Hi all, i have this problem. Why beetwen GetDeviceLayoutValues.ApproximateScreenSize and ActivitySize i have different Result ??

This is code in Activity_create
B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("1")
' < 4.5
If GetDeviceLayoutValues.ApproximateScreenSize < 4.5 Then
    Label2.Text = "ApproximateScreenSize: " & GetDeviceLayoutValues.ApproximateScreenSize
' > 4.5 e < 8
Else If GetDeviceLayoutValues.ApproximateScreenSize > 4.5 AND GetDeviceLayoutValues.ApproximateScreenSize < 8 Then
    Label2.Text = "ApproximateScreenSize: " & GetDeviceLayoutValues.ApproximateScreenSize
'Tablet > 8
Else If GetDeviceLayoutValues.ApproximateScreenSize > 8 Then
    Label2.Text = "ApproximateScreenSize: " &  GetDeviceLayoutValues.ApproximateScreenSize
End If
 
End Sub

This is code in Design Script:

B4X:
'All variants script
AutoScaleAll
 
Label1.Text = "ActivitySize: " & ActivitySize

The result is:
GetDeviceLayoutValues.ApproximateScreenSize = 3.60
ActivitySize = 3.23

screensize.png


Any idea ??

Thank's
Marco
 

wonder

Expert
Licensed User
Longtime User
ApproximateScreenSize is the size of the whole screen. ActivitySize is the size of the activity (without the top and bottom bars).
Erel, please clarify. What does the number mean?
a) Is it the horizontal Size? Vertical Size? Diagonal? Area?
b) Inches or Centimeters?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Top