Android Question S3 Mini Image scaling

Penfound

Active Member
Licensed User
Longtime User
I have an app which at certain time displays an image with some HotSpots. As you can see from the code I thought I had solved the problem of different devices scaling the hotspot location differently by using the %x and %y.

B4X:
Dim Canv AsCanvas
Dim Bitmap1 AsBitmap
Bitmap1.Initialize(File.DirAssets,"UnderBonnet.jpg")
Dim DestRect AsRect
bmpTop = QLabel.Height+10
bmpLeft = 0
bmpRight = 100%X
bmpBottom = bmpTop + Bitmap1.height
lblInstructions.Top=bmpBottom
DestRect.Initiialize(bmpLeft,bmpTop,bmpRight,bmpBottom)
Canv.Initialize(Panel1)
Canv.DrawBitmap(Bitmap1,Null,DestRect)
HotSpotLib.Initialize
Dim Id AsInt
WhsLeft = bmpLeft+8.5%x
WhsTop = bmpTop+10.5%y
WhsDia = 3.5%y
ChsLeft = bmpLeft+5.5%x
ChsTop = bmpTop+15%y
ChsDia = 3.5%y
BhsLeft = bmpLeft+90.5%x
BhsTop = bmpTop+7.2%y
BhsDia = 3.5%y
OhsLeft = bmpLeft+35.5%x
OhsTop = bmpTop+28%y
Ohsdia = 4%y
hsx1 = bmpLeft+7%x
hsx2 = bmpLeft+9.4%x
hsx3 = bmpLeft+5.5%y
hsy1 = bmpTop+16%y
hsy2 = bmpTop+17.5%y
Everything works perfectly on most phone and tablets except the S3 Mini which, for some reason stretches the height of the bitmap, distorting it and therefore allows the hotspots to show in the wrong place.

Does anyone know how I might solve this one, please?

Cheers
Penfound
 

Penfound

Active Member
Licensed User
Longtime User
How is the size of Panel1 set?

B4X:
Panel1.Visible=True
Panel1.Left=0dip
Panel1.Top=0dip
Panel1.Width = 100%x
Panel1.Height = 100%y

Panel1 is the panel holding all the other controls. There is a QPanel forh the question and an APanel for all the answers including the image. Your question has prompted me to check the size of the APanel which I found has not been defined.

Thanks Erel. I will report back here once I have got hold of one of those phones and solved it :)
 
Upvote 0
Top