Android的检测里面的WebView形象点击? [英] android detect image click inside webview?

查看:224
本文介绍了Android的检测里面的WebView形象点击?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要检测< IMG 点击的WebView 里面呢?如果又如何?我需要一个例子PLZ

据我知道我可以检测< A HREF 点击里面的的WebView 以期运用 WebViewClient

但我需要检测< IMG 点击不使用Java脚本可以吗?

这是我的code:

 的WebView的WebView =(的WebView)findViewById(R.id.wv);WebSettings设置= webview.getSettings();
settings.setUseWideViewPort(真);
settings.setLoadsImagesAutomatically(真);
字符串摘要=< HTML和GT;<车身>您打进<&字段集GT;<传奇> adfadf< /传说>中
                    +&下; A HREF =HTTP://192.168.1.100/1.jpg'>&下; IMG SRC =HTTP://192.168.1.100/1.jpg'/>&下; / A>&下; /字段集>中
                    +< B> 192 LT; / B>积分和LT; /身体GT;< / HTML>中;
webview.loadData(总结,text / html的,NULL);


解决方案

请参考这个答案,

<一个href=\"http://stackoverflow.com/questions/4065312/detect-click-on-html-button-through-javascript-in-android-webview\">Detect点击HTML按钮,通过Android的WebView中的JavaScript

同样的程序轨道图片的点击以及。如果它不工作,创建HTML一个按钮,放置图像作为背景的​​按钮,这样你就可以用链接给出答案跟踪按钮。

感谢。

i want to detect <img click inside webview ? if so how ? i need an example plz

so far as i know i can detect <a href click inside webview by useing WebViewClient

but i need to detect <img click without using java script can i ?

this is my code :

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

WebSettings settings = webview.getSettings();
settings.setUseWideViewPort(true);
settings.setLoadsImagesAutomatically(true); 


String summary = "<html><body>You scored <fieldset><legend>adfadf</legend>"
                    + " <a href='http://192.168.1.100/1.jpg'><img src='http://192.168.1.100/1.jpg' /></a> </fieldset> "
                    + " <b>192</b> points.</body></html>";


webview.loadData(summary, "text/html", null);

解决方案

Refer this answer,

Detect click on HTML button through javascript in Android WebView

Same procedure track image click as well. If it doesn't work, create a button in HTML and place the image as background for the button, so you can track the button using answer given in the link.

Thanks.

这篇关于Android的检测里面的WebView形象点击?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆