Android Question AutoScale and aspect ratio

Lee Gillie CCP

Active Member
Licensed User
Longtime User
I have an app whose various layouts were all created as 1200x800 Scale = 1. All layouts are landscape, and I force this mode. Have been using this with an LG VK700 which has a physical screen that is 1280 x 800. Works great. I found this ran very well also on my personal Samsung S 10.5 which is 2560 x 1600. The customer has numerous tablets deployed in the field, and as expected, a few need replacement. The LG is no longer available, so Verizon gave the customer ASUS ZenPad Z 10 which is 2048 x 1536. Now comes the problem. Using autoscale, the generated display is wider than the tablet, that is, stuff on the far right side of the layout is cropped from view.

I suspect the reason this is breaking down is due to the variation of aspect ratio. Design is 1.5, LG is 1.6, Samsung is 1.6, but the new ASUS tablets are 1.333.

That being said, trying to figure out how to deal with this. I have even tried to programmatically scale in my code, but I am finding that only SOME of the views in my layout seem to need scaling.

How are others dealing with similar issues please... ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I found this ran very well also on my personal Samsung S 10.5 which is 2560 x 1600
There is no meaning to these numbers without the scale value.

Now comes the problem. Using autoscale, the generated display is wider than the tablet, that is, stuff on the far right side of the layout is cropped from view.
This is exactly the purpose of anchoring. Just anchor the views to the right or to both sides.
 
Upvote 0

Lee Gillie CCP

Active Member
Licensed User
Longtime User
Thank you for considering my question.

Not sure how to use the info from your first comment. The 2560x1600 numbers are pixel dimensions of the physical device. Currently using AutoScale makes the layout display with everything in view of the physical display, without cropping on the right nor at the bottom of the screen. Positions and sizes are being adjusted to make it all fit when I use AutoScale. My original comment was to describe 2 devices where views are resized/positioned and it is all working well with AutoScale.

To your second comment... I think I understand where your suggestion comes from. Let me see if I understand, and I may have another question... So part of the situation is to have fields largely anchorable on the left, and those anchorable on the right. Anchorable because those views are predominantly on one side of the screen or the other. I can see if device screen size changes, but the size of these views does not scale with width, there will be an area between left anchor views and right anchor views that may grow and shrink, and perhaps possibly, for some device screens, overlap?

[view1] [view2-----------] [view3---] [view4--------------] [view5] [view6---------------------------------] [view7] [view8]
Consider a layout with say 8+ views which are side by side. How to anchor the stuff in the middle, or sorta in the middle?

I'm wrestling to understand how anchoring left/right/both-sides will help? And more importantly, how to anchor properly with many side-by-side views.

My hope was that AutoScale would size all subordinate views, and their placements to keep everything in view of the physical device screen. I think your telling me it is not going to do this?

I've essentially used it that way already successfully between the LG and the Samsung. I can't help but think that AutoScale is moderating what it does with horizontal ordinates and size somewhat based on the vertical size of the screen? Wish I had a better understanding of exactly what computations AutoScale does for me. And how it figures out how to constrain internal scaling calculations. It works so very well when width varies, and aspect ratio of the device remains constant, or at least similar, but as soon as the vertical size is way off for the design aspect ratio, then AutoScale seems to be willing to scale horizontally to exceed the screen dimensions.

When you are trying to scale something of a fixed aspect ratio, into devices with varying aspect ratios one might find a calculation for a scale factor, that can be used for scaling the sizes and positions of view, and sizes of fonts, we might find unused space vertically, or possibly horizontally, but the main priority is that it fully fits in the horizontal space, and fully fits in the vertical space. I'm not sure if this is the approach of AutoScale?

Again, thank you for helping me to understand how it works.
 
Upvote 0
Top