Android disable WebView touch but keep zooming/scrolling

后端 未结 4 757
误落风尘
误落风尘 2021-01-23 16:59

I am looking for a method to disable touch on a WebView so user\'s are not able to click on html links but keep the zooming and scrolling functions of the WebView.

4条回答
  •  情歌与酒
    2021-01-23 17:42

    the code below allow you scroll but when click at the link it won't go to next page.

    webView.setLongClickable(false);
    
    webView.setOnTouchListener(new View.OnTouchListener()
    {
    
      @Override
    
      public boolean onTouch(View arg0, MotionEvent arg1)
      {
    
           return arg1.getAction() == MotionEvent.ACTION_UP;
    
      }
    }
    
    );
    

提交回复
热议问题