【发布时间】:2021-03-02 14:21:24
【问题描述】:
我想在 Jetpack Compose 中使用 Text composable 显示一些文本,并且该文本包含换行符“\n”。如下所示:
Text("This is the first line\nThis is the second line")
但“\n”最终只是文本。
如何让 Text 组件在单独的行上显示新行?
【问题讨论】:
标签: android android-jetpack-compose
我想在 Jetpack Compose 中使用 Text composable 显示一些文本,并且该文本包含换行符“\n”。如下所示:
Text("This is the first line\nThis is the second line")
但“\n”最终只是文本。
如何让 Text 组件在单独的行上显示新行?
【问题讨论】:
标签: android android-jetpack-compose
尝试使用Text("This is the first line\r\nThis is the second line")。这应该可以解决您的问题。
【讨论】: