Portrait on phone, landscape on tablet

sconlon

Active Member
Licensed User
Longtime User
I want my app to run in portrait mode when running on any phone but to take advantage of the larger screen size on tablets I want to run it in landscape mode.

If I choose support for both in Project/Orientations Supported I will have to handle screen rotation which I don't really want to do. Is there any other way of achieving this design?

Ta.
 

moster67

Expert
Licensed User
Longtime User
1) You need to determine if device is a phone or tablet. If you search the forum, you will find code to achieve that. For instance, search for "determine tablet".

2) then use phone-library and use :

B4X:
SetScreenOrientation (Orientation As Int)

according to what you need.
 
Last edited:
Upvote 0

sconlon

Active Member
Licensed User
Longtime User
Thanks for the replyMoster67. I decided that the easiest way for me to determine if it was running on a tablet was to add a label to my tablet screen design which isn't on the normal screen layout and then have the code check for that label. It seems to work.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…