2

我想在与 gmail 共享数据的同时用粗体和新的线条样式书写。我已经尝试过 \n 或者你可以说但我无法得到结果我的代码低于..

        Intent intent = new Intent(Intent.ACTION_SEND); 
        intent.setType("plain/text");
        intent.putExtra(Intent.EXTRA_EMAIL, emailAddressList);  
        intent.putExtra(Intent.EXTRA_SUBJECT, emailSubject); 
        intent.putExtra(Intent.EXTRA_TEXT, "<b>Hi this is test app</b> <br/> your first app is this"); 
        startActivity(Intent.createChooser(intent, "Choice App t send email:"));

但它没有以粗体和新行显示

4

1 回答 1

2

试试下面的代码,它工作正常:) 我已经测试过了

    Intent shareIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:"+emailAddressList));
                shareIntent.putExtra(Intent.EXTRA_SUBJECT, emailSubject);
                shareIntent.putExtra(
                Intent.EXTRA_TEXT,
                Html.fromHtml(new StringBuilder()
                    .append("<p><b>Hi this is test app</b></p>")
                    .append("<small><p>Hi this is test app</small>")
                    .toString()));

                    startActivity(Intent.createChooser(shareIntent, "Choice App t send email:"));
于 2012-10-23T08:37:43.670 回答