I am trying to manually get an image inside an imageview centered and fitting the screen. I need to do it with a matrix (I will later dynamically change the matrix transform
Or using
m.postScale(minScale, minScale); //keep aspect ratio float tx = (getWidth() - bitmap1.getWidth()* scale) * 0.5f ; float ty = (getHeight() - bitmap1.getHeight()* scale) * 0.5f ; matrix.postTranslate(tx, ty );
where getWidth is the width of your imageView. Works perfectly for me