Created
February 5, 2012 19:29
-
-
Save nuthatch/1747558 to your computer and use it in GitHub Desktop.
Android: If you're going to embed a WebView that responds to touch events inside a ScrollView or other touch consumer, you need to override onTouchEvent to requestDisallowInterceptTouchEvent and prevent the parent from stealing your events. Do it!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static final class TouchyWebView extends WebView | |
{ | |
public TouchyWebView(Context context) { | |
super(context); | |
} | |
@Override | |
public boolean onTouchEvent(MotionEvent event){ | |
requestDisallowInterceptTouchEvent(true); | |
return super.onTouchEvent(event); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment