I need to set the zoom level of the image (in an ImageView
) to the original state i.e where it just fits into the ImageView
and all the zoom-in has been removed. what i have tried is to store the image matrix value at the time of opening the image (when it was fit to screen) and then on a 'reset' button click assign this value to the ImageView
that was zoomed in (and might have a modified matrix); but its not helping.. also i am not sure if its just the related matrix that defines the zoom level of the image or there is something else as well that i need to set. my code snippet:
PS. 'zoomMatrix
' is the image matrix at the time when the image has just opened n is fit to screen. 'touch' is the object of the class extending ImageView
.
resetZoom.getItem().setOnMenuItemClickListener(
new MenuItem.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
touch.setImageMatrix(touch.zoomMatrix);
touch.setScaleType(ScaleType.MATRIX);
touch.invalidate();
return true;
}
});