Please help me solve the following problem:
set the maximum dimensions and center the photo on the panel for different bmp sizes.
set the maximum dimensions and center the photo on the panel for different bmp sizes.
B4X:
Dim pnHome as Panel
'The panel contains an ImageView
Dim photo As ImageView
Dim bmp As Bitmap
Dim hb, wb, hp, wp As Int
'Bmp can be portrait or landscape with any dimensions
bmp.Height=hb: bmp.Width=wb
'The panel has fixed dimensions
pnHome.Height=hp: pnHome.Width=wp
photo.Gravity=Gravity.FILL
photo.Bitmap=bmp
'photo. Left =?
'photo.Width=?
'photo. Top =?
'photo. Height=?