I want to display some text using the Text composable in Jetpack Compose and the text contains a new line character ' \n '. Something like below:
Text("This is the first line\nThis is the second line")
But the ' \n ' ends up just being text.
How can I get the Text component to display the new line on a separate line?
Try using Text("This is the first line\r\nThis is the second line")
. This should solve your problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.