android - 如果 android jetpack compose 中的单词太长,则用连字符打破句子行

标签 android android-jetpack-compose

如果单词太长而无法放入,如何用连字符换行。
例如:

|<----screen space----->|

"This is example of veryLongWord." // very long sentence :P

Currently sentence line break like this.

|<------screen space------>|
This is example of |<----->|empty space
veryLongWord.



I want to achieve this:

|<------screen space------>|
This is example of veryLon-
gWord.

最佳答案

因此,在任何人前来救援之前,就我查看 Text() API 而言,没有针对您想要的开箱即用的解决方案。
即使那样,它听起来不像您正在寻找的东西,我所知道的唯一可以使用的解决方案是。

        Text(
        ...
            textAlign = TextAlign.Justify,
            softWrap = true
        ...
        )

关于android - 如果 android jetpack compose 中的单词太长,则用连字符打破句子行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68655165/

相关文章:

android - 还记得 LauncherForActivityResult 导致可组合项丢失状态吗?

java - 空对象引用 setAdapter

android - 在 Android 中从 AsyncTask 检索返回的字符串

kotlin - Android Jetpack 撰写 : Can't find OutlinedTextField in Empty Compose Activity (Material3)

android - Jetpack Compose 文本字段标签不居中

android - 如何从 jetpack compose 中的 viewModel 更改 TextField 值中的值

android - Android中的YouTube横向模式

android - 使用 match_parent 在 ListView 中覆盖 RelativeLayout

android - 无法使用 Glide 刷新验证码图像

android - Android jetpack compose中的按钮长按监听器