ImageView without making picture disproportionate?

IamBot

Member
Licensed User
Longtime User
Is it possible to fill an ImageView with a picture without making the image itself disproportionate when displayed?

Lets say my picture is 640x480 in size and my ImageView is only 100x100. Is it possible to make it scale correctly when displayed?

In this case it should fill in width but stop at 75 in height. Using gravity.fill would fully stretch the image in height as well and cause picture to be disproportionate.

Thank you in advance.
 

Roger Garstang

Well-Known Member
Licensed User
Longtime User
I ran into this a few times and you have to get the ratio as suggested. This works fine if you load it outside B4A and hardcode the ratio too. My issue is usually the reason for needing this to begin with is the bitmap is too large for memory and often loaded by a user. Best solution would be to read the header and get the width/height. I think there may be a library here for that.
 
Upvote 0
Top