Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 920457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:43:04+00:00 2026-05-15T18:43:04+00:00

So is there a way for a webview control to detect a swipe while

  • 0

So is there a way for a webview control to detect a swipe while capable of doing multitouch zoom and having build-in zoom controls?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T18:43:04+00:00Added an answer on May 15, 2026 at 6:43 pm

    YES!There is a way of doing that by implementing WebView and creating a custom Webview
    This way the custom WebView has build in
    swipe detection having at the same time multi touch and build in controls
    for zoom.

    //Declaring the custom Webview and put into a viewflipper
    
    
    MyWebView[] webview =new MyWebView[2];
        flipper = (ViewFlipper) findViewById(R.id.ViewFlipper);
    
     webview[i] = new MyWebView(this);
     webview[i].setWebViewClient(new HelloWebViewClient());
     webview[i].getSettings().setJavaScriptEnabled(false);
     webview[i].setInitialScale(60); 
     webview[i].getSettings().setBuiltInZoomControls(true);
    
        flipper.addView(webview[0]);
        flipper.addView(webview[1]);
    

    and here is the custom webview

     public class MyWebView extends WebView {
      public MyWebView(Context context) {
       super(context);
      }
    
    
    
    @Override 
         public boolean onTouchEvent(MotionEvent evt) {   
    
             boolean consumed = super.onTouchEvent(evt); 
         if (isClickable()) { 
             switch (evt.getAction()) { 
         case MotionEvent.ACTION_DOWN: 
             lastTouchX = evt.getX(); 
             lastTouchY = evt.getY();
             downXValue = evt.getX();
             downTime = evt.getEventTime();
             hasMoved = false; 
             break; 
         case MotionEvent.ACTION_MOVE: 
             hasMoved = moved(evt); 
             break; 
         case MotionEvent.ACTION_UP: 
            float currentX = evt.getX();
               long currentTime = evt.getEventTime();
               float difference = Math.abs(downXValue - currentX);
               long time = currentTime - downTime;
    
               Log.i("Touch Event:",  "Distance: " + difference + "px Time: " + time + "ms");
    
               if ( (downXValue < currentX) && (time < 220) && (difference > 100) ) {
                   go_back();
               }
    
    
    
                 if ( (downXValue > currentX) && (time < 220) && (difference > 100) ) {
                       go_forward();
    
    
                      }
    
                     //if (!moved(evt)) performClick(); 
                     break; 
                 } 
             } 
             return consumed || isClickable(); 
         } 
      float downXValue;
      long downTime;
         private float lastTouchX, lastTouchY; 
         private boolean hasMoved = false; 
         private boolean moved(MotionEvent evt) { 
             return hasMoved || 
                 Math.abs(evt.getX() - lastTouchX) > 10.0 || 
                 Math.abs(evt.getY() - lastTouchY) > 10.0; 
         }
    
     }
    

    And that’s It.You have Build in swipe detection.Code is in a bit “pseudocode” and haven’t cleaned it up but Overriding the onTouchEvent in MotionEvent.ACTION_MOVE and case MotionEvent.ACTION_UP should do the trick.You can also play with the time and difference bounds .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to always show zoom controls in webview? I found this:
I want to change some functionality in the WebView control, is there any way
Is there a way to get the current content of a WebView? What about
I am curious if there is a way from within a WebView when a
Is there way to automatically maximize the output window on hitting build and then
Is there way to mute an audio stream or at least control the volume?
Is there a way to change the text color for entire webView? If it
Is there any way to do this? When a WebView page loads I need
Is there a way to tell browser to show a loader image while a
Is there a way to set the timeout value in WebView? I want the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.