如何在电子邮件正文中添加图像 [英] How to add an image in email body

查看:217
本文介绍了如何在电子邮件正文中添加图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在电子邮件正文中添加图片。
我不想附加图像到电子邮件,但在电子邮件正文中添加一个图像。

I want to add an image in email body. I don't want to attach an image to the email, but add an image in the email body.

如何做?

我正在使用这个。

"<img src=\"data:image/png;base64,"+convertFileTOByteEncrypt()+"\">"

  "<img src=\"http://images.anandtech.com/doci/3982/HTCSurround-0134.jpg\">"

然后图像显示为这样。

推荐答案

不幸的是,Intent不可能这样做。

Unfortunately, it's not possible to do this with Intents.

例如,粗体文本显示在EditText而不是图像中的原因是 StyleSplan 正在实现 ImageSpan 则不包含/os/Parcelable.html\">Parcelable 。所以当在新的Activity中检索到Intent.EXTRA_TEXT时,ImageSpan将无法解开,因此不会成为EditText附加的样式的一部分。

The reason why for example bold text is displayed in the EditText and not an Image is that StyleSplan is implementing Parcelable whereas ImageSpan does not. So when the Intent.EXTRA_TEXT is retrieved in the new Activity the ImageSpan will fail to unparcel and therefor not be part of the style appended to the EditText.

使用其他方法您不会通过意图传递数据,不幸的是,由于您无法控制接收活动,因此不可能。

Using other methods where you don't pass the data with the Intent is unfortunately not possible here as you're not in control of the receiving Activity.

这篇关于如何在电子邮件正文中添加图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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