Loading

Android compose使文本垂直居中

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

Box(
     contentAlignment = Alignment.Center,
 ) {
     Text(
         text = "Text",
         textAlign = TextAlign.Center
     )
 }
posted @ 2022-09-19 09:17  冲锋的麦克  阅读(1671)  评论(0编辑  收藏  举报