将HTML转换为Android上的图像(任何格式) [英] Convert HTML to image (any format) on Android

查看:1126
本文介绍了将HTML转换为Android上的图像(任何格式)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道如何转换成HTML code(带内它的图像)Android上的图像?我知道如何使用的JLabel / JEditorPane中和的BufferedImage使它在Java中,但现在应该做出同样采用Android。

Does anyone know how to convert html code (with images within it) to image on Android? I know how to make it on Java using JLabel/JEditorPane and BufferedImage, but now should make the same with Android.

推荐答案

有关这个任务我用如下技巧:
我用的WebView解析HTML并呼吁WevView对象的方法capturePicture提取HTML的图片,所以我可以建议你后续sniplet:

For this task I use the follow trick: I used a webview to parse HTML and call the method capturePicture on WevView object to extract a Picture of HTML, so I can suggest you the follow sniplet:

WebView wv = new WebView(this);
wv.loadData("<html><body><p>Hello World</p></body></html>");
Picture p = wv.capturePicture();

我希望这可以帮助,但如果你foun不同的方式来解决它,请张贴。

I hope this can help, but if you foun a different way to solve it please post it.

这篇关于将HTML转换为Android上的图像(任何格式)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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