So, just to clarify, I should set the necessary view sizes including text sizes before I insert the AutoScaleAll line ...
It depends on what you mean with this.
Set the positions and sizes of the Views correctly in the 320 x 480 layout and use AuoScale to adapt the views to the device size and if necessary adjust some views afterwards.
If you already have adjusted the positions and sizes of the Views with %x and %y for different screen sized you should not use AutoScale because if you add AutoScale after this it would strech the Views more.
... the AutoScaleAll line as this will then calculate the correct dimensions for the device on which the app is running.
AutoScaleAll does the following:
- It calculates a scaling factor with the formulas below:
Delta = ((100%x + 100%y) / (320dip + 430dip) - 1)
Rate = 0.5 'value between 0 to 1.
Scale = 1 + Rate * Delta
- Then it applies this scaling factor to all Views and the TextSize when relevant like:
View.SetLayout(View.Left * Scale, View.Top * Scale, View.Width * Scale, View.Height * Scale)
If View Is Label Then 'this will catch ALL views with text (EditText, Button, ...)
Dim lbl As Label = View
lbl.TextSize = lbl.TextSize * Scale
End If
Depending on the Rate value the Views will be streched more or less.
Streching with %x and %y can look too streched on big screens so with AutoScale you can play with the rate value.
Rate = 0 no stretching
Rate = 1 almost similar to %x / %y
Can I ask also if it makes a difference if you have the activity set to use the full screen and/or include a title as this obviously reduce the size of the screen available to the activity.
It makes a small difference because the reference value of 430 in the above formula should be 455 or 480.
That means with full screen the original layout will be streched a bit up to 7% with Rate = 1.
Best regards.