Kaa*_*edi 3 android-jetpack-compose
在 jetpack Compose 中,您可以像这样证明Text:
Text(
text = text,
textAlign = TextAlign.Justify
)
Run Code Online (Sandbox Code Playgroud)
如果您想要支持 RTL,可以通过以下方式实现:
Text(
text = text,
textAlign = TextAlign.Right
)
Run Code Online (Sandbox Code Playgroud)
如何Text()在 Jetpack Compose 中支持 RTL 文本并同时对其进行调整?
经过几个小时的测试,我得到了这个:
@Composable
fun JustifiedRTLText(
text: String,
modifier: Modifier = Modifier
) {
CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {
Text(
text = text,
textAlign = TextAlign.Justify,
modifier = modifier,
)
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3047 次 |
| 最近记录: |