[英]How to apply CSS to email body text in Android?
I am sending an email through intent, here I want to set CSS styles to the body of email, I have already referred many questions and answers on Stack and found below code: 我正在通过意图发送电子邮件,这里我想将CSS样式设置为电子邮件正文,我已经在Stack上提到了很多问题和答案,并在下面的代码中找到:
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/html");
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"me@mydomain.com"});
intent.putExtra(Intent.EXTRA_SUBJECT, "I would like to buy the following");
intent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(body));
startActivity(Intent.createChooser(intent, "sending mail"));
but this code sets only text in email body and skips my css styles, how do I achieve that? 但是这段代码只设置了电子邮件正文中的文本并跳过了我的css样式,我该如何实现呢? I want to set background color, text size, text color to the email body all through Android intent.
我想通过Android意图将背景颜色,文本大小,文本颜色设置到电子邮件正文中。
save the html as a file and add your css html attachment to a list of Uri objects and add this line:- 将html保存为文件并将您的css html附件添加到Uri对象列表中并添加以下行: -
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM,uris);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.