gesture-imageview icon indicating copy to clipboard operation
gesture-imageview copied to clipboard

Landscape/portrait rotation messes up the display/zoom factors

Open salberin opened this issue 12 years ago • 1 comments

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?

salberin avatar Jun 29 '12 13:06 salberin

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;
    }

lx2 avatar Apr 07 '13 03:04 lx2