Android Question Unexpected Variant Used On Orientation Change

RichardN

Well-Known Member
Licensed User
Longtime User
I understand that we should use the fewest Designer variants possible making all the size tweaks in the Designer scripts.

My project has the following variants:

360x640 Scale 1 Portrait
640x360 Scale 1 Landscape ..... These 2 work fine with virtually all modern phones

800x1280 Scale 1 Landscape
1280x800 Scale 1 Portrait......... Works fine with 10" tablets and more importantly....makes sure it gets listed in the tablet section of Play Store.

This variant combination is working fine on my Galaxy S4. I also have an HTC Desire S which is a native 480x800 screen. I don't normally provide a variant for this (would be 533x320 scale 1) in the project as the 360x640 variant normally works fine. However in my current project the portrait variant works OK but on changing orientation to landscape the device appears to retain the portrait variant as the best fit without switching to the 640x360 landscape

This behaviour is also reproduced on the UI Cloud where all examples are OK except the Samsung I9000 and Samsung Pocket landscape layouts where the portrait variant is selected by the OS.

I have produced a number of similar layout projects and this is the first time I have seen this. What am I doing wrong?


Just to add: Adding a landscape 533x320 scale 1 variant fixes the issue, but I am left wondering for the future... When will I need to add the extra variant and when can I leave it out ???
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
1280x800 Scale 1 Portrait......... Works fine with 10" tablets and more importantly....makes sure it gets listed in the tablet section of Play Store.
Note that the variants have nothing to do with Play Store. This is a feature specific to B4A. (You do need to make sure that the UI is properly filling the screen.)

I recommend you to use the default variant (320x480, scale=1) and its landscape version instead of the first two variants you created.

The HTC Desire screen is equivalent to 360x533, scale = 1 (it is actually a bit smaller, especially in landscape). This is smaller than the smallest variant. In such cases the algorithm prefers variants where at least one of the dimensions fit.
 
Upvote 0

RichardN

Well-Known Member
Licensed User
Longtime User
Thanks Erel. Using the default portrait & landscape variants removes this 'wrong orientation' behaviour. However designing a layout on a device that does not match the default layouts is less than ideal from the wysiwyg point of view.
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…