Android image scaling in the Gallery -


i have 2 images in gallery view. first add 80x80 image, , bigger 1 (400x400). want both images displayed 80x80 match size of first image.

if hardcode size

image.setlayoutparams(new gallery.layoutparams(80, 80)); image.setscaletype(imageview.scaletype.center_inside); 

all goes ok. if try evade hardcoding in case first image changed

image.setlayoutparams(new gallery.layoutparams(layoutparams.wrap_content, layoutparams.match_parent)); image.setscaletype(imageview.scaletype.center_inside); 

the big image displayed 400x80, , not scaled: central slice of visible.

how can make images in gallery scaled match size of first added image without specifying size directly?

try

image.setlayoutparams(new gallery.layoutparams(layoutparams.match_parent, layoutparams.match_parent)); image.setscaletype(imageview.scaletype.center_inside); 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -