首页 Android 正文
  • 本文约174字,阅读需1分钟
  • 195
  • 0

Android compose使文本垂直居中

摘要

仅使用Text()无法垂直居中。需要将Box()与contentAlignment=Alignment一起使用。居中还有用于对齐的CenterStart和CenterEnd选项。 Box( ...

仅使用Text()无法垂直居中。需要将Box()与contentAlignment=Alignment一起使用。居中还有用于对齐的CenterStart和CenterEnd选项。

Box(
     contentAlignment = Alignment.Center,
 ) {
     Text(
         text = "Text",
         textAlign = TextAlign.Center
     )
 }
标签:compose

扫描二维码,在手机上阅读


    评论