Hello
I'm trying to get a simple layout (320 x 480) to AutoScale up and fit larger resolution devices without it going off the screen.
If I understand Kalus's tutorial correctly then the relevant formulae at work here are as follows:
If I want the layout to fill the screen on a device with a resolution of 640 x 860 (for example) it follows:
delta = ((640 + 860) / (320dip + 430dip) - 1) = ((1500 / 750) -1 ) = (2-1) = 1
rate = 1
scale = 1 + 1 * 1 = 2 <-- The layout will be double the size of the original
Therefore to completely fill the screen on this device AutoScale should be set as AutoScale(1).
On a device with a resolution of 800 x 1280 this AutoScale rate causes the layout to go partially off the screen.
With a resolution of 800 x 1280 the delta value is:
delta = ((1280 + 800) / (320dip + 430dip) - 1) = ((2080 / 750) -1) = (2.773 - 1) = 1.77
However, working out the 'delta' value for the two parts of the resolution separately it gives the following results:
(1280 / 430) -1 = 1.98
(800 / 320) - 1 = 1.5
Is it the 'delta' value that causes the AutoScaled layouts to spill over the screen on devices with certain resolutions?
If this is the case, can the 'delta' value used by the AutoScale process be adjusted so that the layout is only scaled up using the smallest of the delta values?
Regards
Joe
I'm trying to get a simple layout (320 x 480) to AutoScale up and fit larger resolution devices without it going off the screen.
If I understand Kalus's tutorial correctly then the relevant formulae at work here are as follows:
delta = ((100%x + 100%y) / (320dip + 430dip) - 1)
rate = 0.3 'value between 0 to 1.
scale = 1 + rate * delta
The rate determines the change amount in relation to the device physical size.
Value of 0 means no change at all. Value of 1 is almost similar to using %x and %y: If the physical
size is twice the size of the standard phone then the size will be twice the original size.
If I want the layout to fill the screen on a device with a resolution of 640 x 860 (for example) it follows:
delta = ((640 + 860) / (320dip + 430dip) - 1) = ((1500 / 750) -1 ) = (2-1) = 1
rate = 1
scale = 1 + 1 * 1 = 2 <-- The layout will be double the size of the original
Therefore to completely fill the screen on this device AutoScale should be set as AutoScale(1).
On a device with a resolution of 800 x 1280 this AutoScale rate causes the layout to go partially off the screen.
With a resolution of 800 x 1280 the delta value is:
delta = ((1280 + 800) / (320dip + 430dip) - 1) = ((2080 / 750) -1) = (2.773 - 1) = 1.77
However, working out the 'delta' value for the two parts of the resolution separately it gives the following results:
(1280 / 430) -1 = 1.98
(800 / 320) - 1 = 1.5
Is it the 'delta' value that causes the AutoScaled layouts to spill over the screen on devices with certain resolutions?
If this is the case, can the 'delta' value used by the AutoScale process be adjusted so that the layout is only scaled up using the smallest of the delta values?
Regards
Joe