You need to add this line in the loop:
imv.Gravity = Gravity.FILL
In the designer the default gravity of an ImageView is Gravity.FILL but not when you add one in the code.
You should also change this line:
Panel1.AddView(imv, x, y, 85dip * Scale.GetScaleX , 85dip * Scale.GetScaleX)
You should use the same scale value for width and height otherwise the images will not remain square because of the difference of the X and Y scales.
Instead of multiplying each time with the scale in the loop you might define one variable before the loop and use this one in the loop for both, width and height.
Your layout variants are 320 x 533 x 1 and you declare them as 480 x 800 x 1.5 in the code ?
For my tests I changed the layout variants to 480 x 800 x 1.5 to be coherent with your code.
Gravitiy.Fill: yes, in the designer I can choose Center and so I must insert that Line,
thanks ... the images
seem strangely "filled".
I have full confidence in your experience and in your module, but I need to understand (the fish

).
For example, if the ratio between the width and height of my layout was 1:3, 200W x 600H x1 and my view was 100W x 200H x1 (1:2) using ScaleAll or ScaleView my view would not keep the relationship 1:2? It seems to me that this happens and that my layouts are correct, after ScaleAll (Activity, True). So I thought I should just use ScaleView in the same way on each view added by code.
Now, you said i had to use a same var for both dimensions, because the view is squared, but if it was a rectangle?
You wrote:
Your layout variants are 320 x 533 x 1 and you declare them as 480 x 800 x 1.5 in the code ?
For my tests I changed the layout variants to 480 x 800 x 1.5 to be coherent with your code.
Don't ask me why

but...
I had trouble uploading my old layout (480x800) in the designer. More precisely, loading them and then using SetReferenceLayout (480, 800, 1.5) and ScaleAll I did not get the result I was hoping for.
I added a variant, for each old layout, indicating 480x800-1.5 but allowing the designer to normalize it and he did it to 320x533-1 (and I deleted the old 480... variant). Then, in the code I used SetReferenceLayout (480, 800, 1.5) and ScaleAll and everything seems ok.
[UPDATED] Not, my layouts are "adapted" ma the views has not the same ratio on all devices.
I'm doing it all wrong. I am launching survival white flag; I surrender
I thank you very much for your interest and for your answers, Klaus
P.S. I need an "on screen" ruler
