我现在通过textview把html加载进去。html中的图片也可以显示。但是我怎么能一点图片让他显示大图呢。怎么给图片加事件。
String html = "<h2>html测试</h2><p font='red'>这是测试内容</p><p><img src='http://www.baidu.com/img/baidu_sylogo1.gif'></p>";
tv.setText(Html.fromHtml(html,new Html.ImageGetter(){ @Override
public Drawable getDrawable(String source) {
Drawable myDrawable = null;
try {
myDrawable = Drawable.createFromStream(new URL(source).openStream(), "baidu_sylogo1.gif");
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} myDrawable=zoomDrawable(myDrawable,120,80);
myDrawable.setBounds(0, 0, myDrawable.getIntrinsicWidth(), myDrawable.getIntrinsicHeight()); return myDrawable;
}},null));各位大哥看看。怎么能把图片加上事件。或者不是这么做?有没有什么办法
String html = "<h2>html测试</h2><p font='red'>这是测试内容</p><p><img src='http://www.baidu.com/img/baidu_sylogo1.gif'></p>";
tv.setText(Html.fromHtml(html,new Html.ImageGetter(){ @Override
public Drawable getDrawable(String source) {
Drawable myDrawable = null;
try {
myDrawable = Drawable.createFromStream(new URL(source).openStream(), "baidu_sylogo1.gif");
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} myDrawable=zoomDrawable(myDrawable,120,80);
myDrawable.setBounds(0, 0, myDrawable.getIntrinsicWidth(), myDrawable.getIntrinsicHeight()); return myDrawable;
}},null));各位大哥看看。怎么能把图片加上事件。或者不是这么做?有没有什么办法
tv.setText(Html.fromHtml(htmlLinkText));
tv.setMovementMethod(LinkMovementMethod.getInstance());
再去自己做处理吧。
http://blog.csdn.net/k763925053/article/details/7967138