Sub SettingLayoutPanel(ac As Activity, pn As Panel)
Dim xleft, xtop, xwidth, xheight, lwidth, lheigh As Int
Dim ScaleX, ScaleY As Float
lwidth = ac.Width ' larghezza display
lheigh = ac.Height ' altezza display
ScaleX = lwidth / 320 / Density
ScaleY = lheigh / 430 / Density ' 480 - 2 * 25
For i = 0 To pn.NumberOfViews-1
' calculate
xleft = pn.GetView(i).Left * ScaleX
xtop = pn.GetView(i).Top * ScaleY
xwidth = pn.GetView(i).Width * ScaleX
xheight = pn.GetView(i).Height * ScaleY
' setting object
pn.GetView(i).SetLayout(xleft,xtop,xwidth,xheight)
Next
End Sub