我现在通过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));各位大哥看看。怎么能把图片加上事件。或者不是这么做?有没有什么办法
解决方案 »
- android请求webervice问题 在线等....
- 涂鸦 橡皮擦!!!!!急!!!
- 新手学习Android 什么书好一些(自学)
- android开发 拨号程序
- AudioRecord录音问题
- android market上软件
- webview加载字符串拼成的html,有点链接点击无响应怎么回事?
- (cocos2dx交叉编译android过程)eclipse的run as和debug as疑问
- Android应用 访问 内网?
- 我是刚刚大一刚刚入门的学生,老师布置的作业搞不懂请教各位大神RecycleView中部分控件的显示和隐藏.
- CTS运行报错
- 各位大侠 ,微信中的“听首老歌”的页面怎样实现的???
tv.setText(Html.fromHtml(htmlLinkText));
tv.setMovementMethod(LinkMovementMethod.getInstance());
再去自己做处理吧。
http://blog.csdn.net/k763925053/article/details/7967138