Skip to content

Instantly share code, notes, and snippets.

@nuthatch
Created February 5, 2012 19:29
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nuthatch/1747558 to your computer and use it in GitHub Desktop.
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!
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