HarmonyOS 文字在Row中不居中

很简单的案例:

Row() {
  Text("测试文字")
}.backgroundColor('#be14807f')
  • 1.
  • 2.
  • 3.

这个时候可以看见文字并没有居中偏顶部。

HarmonyOS
2024-12-24 17:38:29
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
Excelsior_abit

参考demo:

Row() {
  Text("测试文字")
}
.backgroundColor('#be14807f')
.height(100)
.width(100)
.align(Alignment.Center)
.justifyContent(FlexAlign.Center)
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.

参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-container-row-V5

分享
微博
QQ
微信
回复
2024-12-24 19:51:33
相关问题
HarmonyOS 文字行高设定后文字居中
1030浏览 • 1回复 待解决
HarmonyOS Row组件怎么居中
578浏览 • 1回复 待解决
HarmonyOS 弹窗文字居中
424浏览 • 1回复 待解决
画布绘制文字,垂直居中
949浏览 • 1回复 待解决
HarmonyOS 文字标题没有垂直居中对齐
635浏览 • 1回复 待解决
HarmonyOS Text设置align居中
1156浏览 • 1回复 待解决
HarmonyOS RichEditor 内容居中显示
683浏览 • 1回复 待解决
HarmonyOS使用canvas如何使文字垂直居中
1422浏览 • 1回复 待解决
HarmonyOS bindsheet弹出居中弹框
663浏览 • 1回复 待解决
HarmonyOS row的子控件超出了row的范围
1272浏览 • 1回复 待解决
嵌套组件Scroll生效
2817浏览 • 1回复 待解决