我正在创建一个 android 应用程序,其中有一个按钮可以在电子邮件中发送一些信息,我不想将所有内容都放在一个段落中。
以下是我的应用为电子邮件正文的 putExtra 所做的:
I am the first part of the info being emailed. I am the second part. I am the third part.
这就是我想要它做的事情:
I am the first part of the info being emailed.
I am the second part.
I am the third part.
如何将新行放入字符串或使用 putExtra
方法来完成?
最佳答案
试试:
String str = "my string \n my other string";
打印后你会得到:
我的字符串
我的其他字符串
关于android - 如何在Android中的字符串中插入新行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6379975/