0

How to zoom the imageview on the double click in viewflipper ? I want to zoom the imageview on double tap of viewflipper.Can anyone please tel me how to do the zoom on double tap of imageview of viewflipper.Thanks in advance..

indraja machani
  • 679
  • 1
  • 9
  • 25

2 Answers2

1

You can use the ImageViewZoom instead of a regular ImageView as described here.

Dennis Winter
  • 2,027
  • 4
  • 32
  • 45
1

You can use a GestureListener to detect double taps in your viewflipper class.

public ZoomingViewFlipper(Context context, AttributeSet attrs) {
    super(context, attrs);  
    gestureDetector = new GestureDetector(context, new GestureListener());
}   

@Override
public boolean onTouchEvent(MotionEvent e) {
    return gestureDetector.onTouchEvent(e);
}     

private class GestureListener extends GestureDetector.SimpleOnGestureListener {

    @Override
    public boolean onDown(MotionEvent e) {
        return true;
    }        
    @Override
    public boolean onDoubleTap(MotionEvent e) {
        //Your method to zoom the imageview    
        return true;
    }
}

For the actual zooming in you use a solution from here or use ImageViewZoom or write your own method.

Community
  • 1
  • 1
Edward van Raak
  • 4,841
  • 3
  • 24
  • 38