Android Question ImageView Gravity Fill Center Crop

scsjc

Well-Known Member
Licensed User
Longtime User
Is it possible to crop the image to maintain the proportion and fill in the maximum imageview space?

 

Alexander Stolte

Expert
Licensed User
Longtime User
Is it possible to crop the image to maintain the proportion and fill in the maximum imageview space?
Yes:
B4X:
    Dim xui As XUI
    Dim iv As ImageView
    iv.Initialize("")
    iv.Bitmap = xui.LoadBitmapResize(File.DirAssets,"myimage.png",iv.Width,iv.Height,True)

EDIT: the "true" at the end is important!
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…