Detect Orientation in Designer Script

TestMyChess

Member
Licensed User
Longtime User
I've searched the docs long and hard for this as I'm sure I'm missing something obvious. I want to position some views differently based on the orientation.

I started with two layout files - portrait and landscape - which worked fine. I then saw a comment by Erel that this was unnecessary, so I tried to do it with a single layout file. But I can't work out what the designer script equivalent of
B4X:
If Activity.Width > Activity.Height Then
is. :BangHead:
John
 

TestMyChess

Member
Licensed User
Longtime User
Thanks, Erel. That was the first thing I tried, but I must have got the syntax wrong somewhere, since I got an error message and started trying other things.

Sigh.

John
 
Upvote 0

tecevit

Member
Licensed User
Longtime User
Hi,
This worked for me :

If 100%x > 100%y Then
Label1.Top = 0%y
Else
Label1.Bottom = 100%y
End If


In Landscape mode, Label1 is at the top, in portrait mode, at the bottom.
 
Upvote 0
Top