简体   繁体   English

检测带有HTML数据的ANDROID中的WebView单击

[英]Detect Click on WebView in ANDROID with HTML data

I am trying to find whether a user clicks a webview in android. 我正在尝试查找用户是否单击了android中的webview。 The WebView Contains some html/javascript that loads. WebView包含一些加载的html / javascript。 I want to find whether the user clicks the webview. 我想查找用户是否单击Web视图。

thanks for the help. 谢谢您的帮助。

the code is something like this: 代码是这样的:

//....// //....//

    wv = (WebView) findViewById(R.id.webView1);

    wv.getSettings().setJavaScriptEnabled(true);

    wv.setBackgroundColor(Color.TRANSPARENT);
    String html = "<html><body style='margin:0;padding:0;'><script='text/javascript' src='URL'></script></body></html>";

    wv.loadData(html, "text/html", "utf-8");

//....// //....//

thanks for the help.... 谢谢您的帮助....

Create handler in your android application like 在您的Android应用程序中创建处理程序,例如

wv.addJavascriptInterface(new JavaScriptHandler(this),"MyHandler");

And in your HTML using action listener callback method with your android handler then you can monitor your webview activities from android Similar Example Here 而在使用动作监听器回调方法与Android的处理程序,那么你可以监视你的Android的WebView活动你的HTML 类似的例子在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM