android - 如何在Android中的字符串中插入新行

标签 android string enter

我正在创建一个 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/

相关文章:

java - 类似 GridView 的 View 或布局

android - Facebook 分享错误 : "the page you requested cannot be displayed right now"

mysql - MARIADB - 如果未提供默认值,SQL 能否将 NULL 转换为空字符串?

android - 如何处理 Android 中的重复字符串以减少内存使用?

带有可变十进制数说明符的 Python f 字符串

c# - 我可以通过蓝牙将签名的 APK 发送到设备以快速测试构建吗

javascript - ASP.NET 在按下 Enter 键时调用 javascript 函数

javascript - 规避asp事件处理程序

Android 在为 EditText 按 "Enter"后执行功能

android - 在 .xml 或以编程方式设置文本大小