I would like the text to utilize complete row space and break to a new line if the word overflows the row space. Is there any way to achieve this in Jetpack Compose Text? I did not find any solution here https://developer.android.com/jetpack/compose/text
Expected:
Code:
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MaterialTheme {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colors.background
) {
ShowText()
}
}
}
}
}
@Composable
fun ShowText() {
Text(text = "This is a veeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerrrrryyyyyyyyyyyy looooooong text", softWrap = true)
}
@Preview
@Composable
fun Preview() {
MaterialTheme {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colors.background
) {
ShowText()
}
}
}


