Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pinch zoom doesn't zoom out on move to next fragment page

I had done pinch zoom with this polidea Zoomview.I have implemented this pinch zoom code in fragment page.

ZoomView zoomView;

//inside onCreateView method

zoomView= new ZoomView(getActivity());
zoomView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

zoomView.addView(gridTable);
zoomView.setRotationY(180);
gridviewlayout.addView(zoomView);

zoomview jar

Pinch Zoom in and Zoom out was working in gridview table page.But If I zoom-in a page and then scroll to next fragment page.After that when i go back to previous fragment page,the page is still in zoomed state.

What I am trying to do is reset the page in normal state when I move to next fragment page.

I searched a lot of samples.But Everything is related to Imageview.I didn't get any sample for pinch zoom in fragments with layout.

Anyone can help me with this.Thank you.

like image 269
Steve Avatar asked Apr 27 '15 05:04

Steve


People also ask

How do you pinch zoom on an emulator?

The pinch key on the emulator is the Alt key. Hold down Alt and click and drag your mouse button.

How do you zoom out on Android emulator?

Double-click the remote device screen in order to zoom in or out.

What is pinch zoom in Android?

Pinch 2 or more fingers together or apart to adjust zoom. To zoom temporarily, quickly tap the screen 3 times and hold down your finger on the third tap. Drag your finger to move around the screen. Lift your finger to zoom out.


1 Answers

add below code to your fragment:

@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
    super.setUserVisibleHint(isVisibleToUser);
    if(!isVisibleToUser){
        if(mZoomView != null)mZoomView.zoomTo(1,0,0);
    }
}
like image 107
mmlooloo Avatar answered Oct 18 '22 09:10

mmlooloo