Yes indeed. Should I use 100%x and 100%y for right and bottom or is it better to use 320 and 480 dip?
AutoScaleAll
pnlMenu.SetLeftAndRight(0dip, 100%x)
pnlMenu.SetTopAndBottom(0dip, 200dip)
AutoScaleAll
pnlMenu.SetLeftAndRight(0dip, 100%x)
pnlMenu.SetTopAndBottom(0dip, 50%y)
AutoScaleAll
pnlMenu.SetLeftAndRight(0dip, 320dip)
pnlMenu.SetTopAndBottom(0dip, 480dip)
pnlMenu.SetLeftAndRight(0,320dip)
pnlMenu.SetTopAndBottom(0,480dip)
pnlMenu.SetLeftAndRight(0,100%x)
pnlMenu.SetTopAndBottom(0,100%y)
AutoScaleAll
pnlMenu.HorizontalCenter = 50%x
pnlMenu.VerticalCenter = 50%y
Sorry, but this is wrong.Now, by doing this:
That will create a view that is PROPORTIONALLY scaled to the size of the screen (in percentages).B4X:AutoScaleAll pnlMenu.SetLeftAndRight(0dip, 320dip) pnlMenu.SetTopAndBottom(0dip, 480dip)
It depends on what you mean with this.So, just to clarify, I should set the necessary view sizes including text sizes before I insert the AutoScaleAll line ...
AutoScaleAll does the following:... the AutoScaleAll line as this will then calculate the correct dimensions for the device on which the app is running.
Delta = ((100%x + 100%y) / (320dip + 430dip) - 1)
Rate = 0.5 'value between 0 to 1.
Scale = 1 + Rate * Delta
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
It makes a small difference because the reference value of 430 in the above formula should be 455 or 480.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.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?