Android Question ImageView FILL Does not work on all android devices?

ronovar

Active Member
Licensed User
Longtime User
I have the following code:

B4X:
   'INIT - ImageView
    imgChLogo.Initialize("imgChLogo")
    imgChLogo.Bitmap = bmpChLogo
    'imgChLogo.Gravity = Gravity.FILL
    imgRed.Initialize("imgRed")
    imgRed.Bitmap = bmpRed
    imgRed.Gravity = Gravity.Fill
    imgGreen.Initialize("imgGreen")
    imgGreen.Bitmap = bmpGreen
    imgGreen.Gravity = Gravity.Fill
    imgBlue.Initialize("imgBlue")
    imgBlue.Bitmap = bmpBlue
    imgBlue.Gravity = Gravity.Fill

That works great on Android Box Manufacturer A, on another Android Box Manufacturer B images are big and not centered...so i added ScaleType in calulation..images are now scalled OK on Box B but some of images are not centered (first item is on top, second is half on bottom and so on)..so how to center imageview inside panel?

I try the following code and some imageview is centered and some is not...where i im doing wrong?

B4X:
    'SET - ImageView
    imgChLogo.Width = Round(bmpChLogo.Width * Scale)
    imgChLogo.Height = Round(bmpChLogo.Height * Scale)
    imgRed.Width  = Round(bmpRed.Width * Scale)
    imgRed.Height = Round(bmpRed.Height * Scale)
    imgGreen.Width  = Round(bmpGreen.Width * Scale)
    imgGreen.Height = Round(bmpGreen.Height * Scale)
    imgBlue.Width  = Round(bmpBlue.Width * Scale)
    imgBlue.Height = Round(bmpBlue.Height * Scale)

    'TOP - ImageView of imgChLogo
    imgChLogo.Top = pnlSlave.Height - imgChLogo.Height
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…