简体   繁体   中英

zoom the imageview on the double click in viewflipper in android

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..

您可以使用ImageViewZoom而不是常规的ImageView描述在这里

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM