Android Question B4X multiple orientation

marcick

Well-Known Member
Licensed User
Longtime User
Hi all,
As for subject, how to simply handle both portrait and landscape layout in a B4X Android app ?
 

LucaMs

Expert
Licensed User
Longtime User
Maybe I'm wrong but... are you asking how to do this in a B4XPages project? I hope it's clear that B4XPages and B4X are not the same thing. By B4X we mean the language that, with some adjustments, can be suitable on various platforms.

With B4XPages projects in B4A the only way to have both orientations is to use the Main Activity in one of the two and one or more other Activities with the opposite orientation.

If, however, you were not referring to B4XPages projects, search the site, as it is a topic that has been written about a lot.
 
Upvote 1

marcick

Well-Known Member
Licensed User
Longtime User
Sorry LucaMS for the typo, yes, I was meaning B4xPages. So, starting from a “portrait “ project do I have to detect page_resize in MainPage and then ? Reload a second layout if I detect landscape orientation?
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Sorry LucaMS for the typo, yes, I was meaning B4xPages. So, starting from a “portrait “ project do I have to detect page_resize in MainPage and then ? Reload a second layout if I detect landscape orientation?
No, you will have to set:
#SupportedOrientations: portrait (or landscape)
in the Main Activity, then create another Activity in landscape (or portrait, if... see above).
Unfortunately the B4XPages will only work with the Main Activity, the other Activities will work in the classic way.

But right now it's occurring to me that someone tried to do what you wanted, but I don't remember if they succeeded. I look for...
 
Upvote 0

Alessandro71

Well-Known Member
Licensed User
Longtime User
If setting the app orientation at startup is enough for you, you can use this
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
If setting the app orientation at startup is enough for you, you can use this
In my case it is not so important that the user can rotate the device when the app is running. He can set before the device orientation and then he can run the app. So, this is a good solution for me. Thanks
 
Upvote 0
Top