Layout Variants

rgately

Member
Licensed User
Longtime User
In Designer, I was building 2 Layout Variants for one Layout file. I created a variant for portrait mode and another for landscape mode.

I was pleasantly surprised to see that the variants automatically changed whenever the orientation changed. In other words, when the device was rotated to Landscape orientation, the Landscape variant was automatically shown and the Portrait variant was shown when the device was rotated to Portrait orientation.

I didn't write any code to do this and am happy that it "just works" but I would appreciate it if someone could point me to where this action is specifically talked about so that I can better understand what's happening. Admittedly, I have a lot yet to learn.

Thanks!
 

klaus

Expert
Licensed User
Longtime User
The orientation change is done automatically by the OS.
- Activity_Pause the current activity is paused. If you need to memorize parameters you should do it here.
- Activity_Create, here when loading a layout file with different variants the OS chooses the best fitting one according to the device. If you want or need to rearrange some views you should do in this routine.
- Activity_Resume, if needed memorized parameters should be restored in this routine.

Best regards.
 
Upvote 0

rgately

Member
Licensed User
Longtime User
Thanks Klaus,

It's the O.S. that is choosing the layout that fits the best when the orientation is changed. That's what I needed to know.
 
Upvote 0
Top