gesture-imageview
gesture-imageview copied to clipboard
Landscape/portrait rotation messes up the display/zoom factors
When rotating the view while zoomed in, or even without zooming in, rotating and then zooming in, it messes up the internal state and the image becomes displaced and aligned to the left. I've tried fixing this, but have been unsuccesfull so far. You can reproduce the behaviour using the imageview-example. It does not matter which ScaleType you use, it happens with all of them.
Can anyone confirm if this is the case for you as well?
I used this in my onMesure():
int devicewidth = ((Activity) getContext()).getWindowManager().getDefaultDisplay().getWidth();
int deviceheight= ((Activity) getContext()).getWindowManager().getDefaultDisplay().getHeight();
int orientation = getResources().getConfiguration().orientation;
if(orientation == Configuration.ORIENTATION_LANDSCAPE) {
displayWidth = deviceheight;
displayHeight= devicewidth;
}
else{
displayWidth = devicewidth;
displayHeight= deviceheight;
}