1

これについては少し奇妙です。私のアプリでは、StringBuilder を使用して文字列を作成し、電子メールを作成しています。

今私がやろうとしているのは、テキストの一部をタブ付きで電子メールを送信することです (テキストは Word ドキュメントに転送され、これにより多くの編集が節約されます)。

したがって、私のコードでは、タブを含めるコードを書いています。次に例を示します。

message.append(component).append("\t\t\t\t\t\t\t\t\t\t\t\t").append(risk).append("\r\n");

次のコードを使用して電子メールを作成します。

private void sendEmail(String recipient, String subject, String message) { 
    try { 
        final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); 
        emailIntent.setType("text/html");
        emailIntent.setType("message/rfc822");          

        if (recipient != null)  emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{recipient}); 
        if (subject != null)    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject); 
        if (message != null)    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, message); 

        startActivity(Intent.createChooser(emailIntent, "Send mail...")); 

    } catch (ActivityNotFoundException e) { 
        // cannot send email for some reason 
    } 
}

そのため、送信前に電子メールを見ると、タブが機能しているように見えますが、電子メールを受信するとタブがありません。ブー。

なぜこれが考えられるのでしょうか?

4

1 に答える 1

0

コードを試してみたところ、メールの送信中にタブ記号がトリミングされたようです。また、この方法を試してみましたが、(gmail で) 正常に動作しますが、解決策は醜いです

 private String tab(){
    return "    "; // return four space characters
}

message.append(tab()+tab+tab());
于 2013-02-08T23:08:34.593 に答える