Search code examples
androidandroid-layoutandroid-webviewviewflipper

WebView in ViewFlipper doesn't get swipe gestures


What I need: I need to have different WebViews inside a ViewFlipper and then I want to have gestureListening on ViewFlipper for Swipe actions on Left Right switching.

What I have: I have added WebViews in ViewFlipper and they are getting loaded.

What is the problem: When I want to swipe left/right, it doesn't work and WebViews do not get changed. When I test the same ViewFlipper and code with ImageViews, it works fine.

What can be the issue with WebViews in ViewFlipper?


Solution

  • Simply add this code on your activity

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