【问题标题】:Posting HTML Content - Table in Android Email BOdy发布 HTML 内容 - Android 电子邮件正文中的表格
【发布时间】:2015-01-06 07:55:14
【问题描述】:

我想在我的应用程序的 Android GMAIL 正文中显示 TABULAR 数据,预先填写。 Stackoverflow 上有许多类似的主题,但没有人为我的特定问题提供好的解决方案。

这就是我正在做的,

final Intent shareIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:"));
                shareIntent.putExtra(Intent.EXTRA_SUBJECT, "The Subject");
                shareIntent.putExtra(
                Intent.EXTRA_TEXT,
                Html.fromHtml("<!DOCTYPE html><html><body><table><tr><th>head 1</th><th>head 2</th><th>head 3</th></tr><tr><td>data 1</td><td>data 2</td><td>data 3</td></tr></table></body></html>"));
                mContext.startActivity(shareIntent);

谁能检查一下,让我知道我做错了什么?

【问题讨论】:

  • 我认为你应该添加 settype..
  • 我必须在哪里添加这个?
  • intent初始化后..你有什么错误吗?你能展示UI设计吗..

标签: android html android-intent html-email


【解决方案1】:

试试下面的代码:

final Intent shareIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:"));
shareIntent.putExtra(Intent.EXTRA_SUBJECT, "The Subject");
shareIntent.putExtra(
Intent.EXTRA_TEXT,
Html.fromHtml(new StringBuilder()
    .append("<p><b>Some Content</b></p>")
    .append("<small><p>More content</p></small>")
    .toString())
);

更多链接见

android - How to format the text as table in email body of email client

How to send HTML email

还要检查这是否适用于 Android 4.0 及更高版本。

【讨论】:

    猜你喜欢
    • 2012-01-28
    • 1970-01-01
    • 2018-04-29
    • 1970-01-01
    • 2014-01-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-03
    相关资源
    最近更新 更多