resizing (or scaling) a bitmap is a solution to a particular problem,
but it can have unpleasant side effects. before resizing, you need
to take into account the dimensions of the bitmap and of the image
view and think about what the result will look like. a large bitmap
greatly reduced or a small bitmap greatly enlarged are unpleasant
to look at.
there are 3 ways to proceed:
1) decide on size of image view and (possibly) resize images to fit.
or
2) use image size to create an image view of that size.
or
3) load a bitmap "sample" to fit a given image view.
these links refer to bitmap scaling
original method:
https://www.b4x.com/android/forum/threads/loadbitmap-loadbitmapresize-loadbitmapsample.82693/
latest:
https://www.b4x.com/android/forum/threads/b4x-b4ximageview-imageview-resize-modes.121359/#content
i am more familiar with the original method, so to fit a large image on your device's screen,
an example might be:
dim iv as imageview
iv.initialize("iv")
activity.addview(iv,0%x,0%y,100%x,100%y) ' image view fills the screen
iv.bitmap = loadbitmapresize(file.dirassets,"bitmap.png",iv.width,iv.height,true)
this assumes 2 things:
1) you want to use the full screen to display the bitmap
2) the bitmap is already stored on your device.
if you are downloading a bitmap (eg, with okhttputils2), then when you download the bitmap
(dim downloadedbitmap as bitmap = httpjob.getbitmap), just resize it:
iv.bitmap = downloadedbit.resize(iv.width,iv.height,true)
if the bitmap width and height are both smaller than imageview's width and height, then you
don't need resizing. just set the imageview's bitmap and center the gravity.