看起来 hyphen
只是最近在 Compose 1.3.0-rc01
发布的 Experimental API 中被支持。
https://developer.android.com/jetpack/androidx/releases/compose-ui#1.3.0-rc01
如果你使用该版本的Compose,你可以在 TextStyle
参数中期待类似这样的内容。
(
...
hyphens = Hyphens.Auto
...
)
TextStyle
中添加了一个连字符策略,通过添加Hyphens.Auto
来实现,正如其他回答所解释的那样。TextStyle
属性lineBreak
,然后它将变成这样。 Text(
text = "Korrespondenz\u00ADsprache",
style = MaterialTheme.typography.h4.copy(
hyphens = Hyphens.Auto,
lineBreak = LineBreak.Paragraph)
)