Orientation

Mikie

Member
Licensed User
Longtime User
Is there anyway in one app to have one page landscape and another page portrait?
 

devlei

Active Member
Licensed User
Longtime User
Is it not possible to create one layout that can scroll?

If so, is Scrollview the best option?
 
Upvote 0

eps

Expert
Licensed User
Longtime User
That won't really work, half of your screen would be empty and a third off the screen..

Scrollview is used to display a list of items. See the tutorial and documentation
 
Upvote 0

devlei

Active Member
Licensed User
Longtime User
Thanks for that advice!!

I have used the following to test for orientation then add/draw one column of Views for portrait and two columns of Views for landscape.
B4X:
If Activity.Height > Activity.Width Then
   Draw4Portrait
Else
   Draw4Landscape
End If
It works fine when running for first time (in both orientations), but as soon as I change orientation (while running) and Activity_Resume occurs it says Views need to be initialized. If I initialize the views, then I get a NullException.

I am a bit confused with this initializing of views, because up to now I have only added/altered views in the Designer and everything always worked fine without any initializing.

Can someone assist a newbie with a probably a very basic thing I am missing?
 
Upvote 0

Mikie

Member
Licensed User
Longtime User
Thanks, everyone. It worked.
 
Upvote 0

eps

Expert
Licensed User
Longtime User
Thanks for that advice!!

I have used the following to test for orientation then add/draw one column of Views for portrait and two columns of Views for landscape.
B4X:
If Activity.Height > Activity.Width Then
   Draw4Portrait
Else
   Draw4Landscape
End If
It works fine when running for first time (in both orientations), but as soon as I change orientation (while running) and Activity_Resume occurs it says Views need to be initialized. If I initialize the views, then I get a NullException.

I am a bit confused with this initializing of views, because up to now I have only added/altered views in the Designer and everything always worked fine without any initializing.

Can someone assist a newbie with a probably a very basic thing I am missing?

Like that code btw! :)
 
Upvote 0
Top