Limit touch screen controls for WebView links

Is it possible to record touch events via WebView in its active part without losing the functionality of links?

Consider a WebView showing a web page with links. If the user clicks on the link, I would like WebView to handle the touch event. If the user deletes something elsewhere, I would like the activity to handle the touch event.

How can I do that?

+3
source share
4 answers

Yes it is.

(I can’t talk more about this if you don’t clarify your question.)

0
source

, , - onTouchEvent(), , , X, Y ( html). , , , , Javascript WebView, javascript , - . , ... .

0

WebView :

mWebView.setWebViewClient(new WebViewClientOverrider());

:

private class WebViewClientOverrider extends WebViewClient {
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        //TODO handle the link  
        return true;
    }
}

, TODO .

0

:

android.webkit.CallbackProxy.uiOverrideUrlLoading()

. http://www.javapractices.com/topic/TopicAction.do?Id=78, ( WebView.loadUrl()).

0

Source: https://habr.com/ru/post/1789779/


All Articles