I have an Application, in one of myActivity i am using webView. With some type of tablets i have the problem of double touch. a touch event in My JS and other in Android. I can't remove the touch event in JS because with some tablets. i ought to implement it. So I would like to Stop the Android touch events for this Activity and it's child and not for all the application. I tried

public static void enableDisableViewGroup(ViewGroup viewGroup, boolean enabled) {
    int childCount = viewGroup.getChildCount();
    for (int i = 0; i < childCount; i++) {
        View view = viewGroup.getChildAt(i);
        view.setEnabled(enabled);
        if (view instanceof ViewGroup) {
            enableDisableViewGroup((ViewGroup) view, enabled);
        }
    }
}
有帮助吗?

解决方案

The way to ignore a touch event on a webview is quite simple, just do :

mWebView.setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        return false; //returns true if you wan't also ignore the js touch events
    }
});

The thing is, I'm not sure the triggered event are from the webview or another view, you need to define it so you can set this same OnTouchListener on the appropriate view.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top