Android WebView use setWideViewPort, disable double-tap zoom but keep pinch zoom?

前端 未结 4 1615
無奈伤痛
無奈伤痛 2021-02-03 14:51

I am using this code and it works exactly as I want. But I have to implemented another feature on double tap and would like to disable the double tap zooming (but keeping the pi

4条回答
  •  感情败类
    2021-02-03 15:11

    Found a solution:

    class MyWebView extends WebView { 
    
        public boolean onTouchEvent(MotionEvent event) {
    
                gd.onTouchEvent(event);
    
                // disable double tap zooming
    
            if(doubleTap)
                {
                    doubleTap = false;
                    return false;
                }
    
                return super.onTouchEvent(event);
            }
    
    
        GestureDetector.SimpleOnGestureListener sogl = new GestureDetector.SimpleOnGestureListener() { 
    
    
    
    
                public boolean onDoubleTap(MotionEvent e) {
    
                        showToast("Double tap");
                        doubleTap = true;
    
                        return false;
                }        
    }
    

提交回复
热议问题