TextClock在Row居中的时候,文字无法与其他的控件垂直对齐问题
TextClock在Row居中的时候,文字无法与其他的控件垂直对齐问题
TextClock这个也不知道源码怎么做的的,没有Text一些相关的属性,使用之后发现无法对齐可以看出来文字和图片是没有对齐的
Row({ space: 5 }) {
//时间计算
TextClock({ timeZoneOffset: -8, controller: this.textClockController })
.width('auto')
.height('auto')
.format('HH:mm')
.fontSize("12vp")
.align(Alignment.Center)
.onDateChange((value: number) => {
if (this.isDebug) {
this.log("onDateChange()", `value = ${value}`);
}
});
Stack({ alignContent: Alignment.Center }) {
Image($r('app.media.read_battery_bg_day_default'))
.width('22.5vp')
.height('10vp');
Progress({ value: this.batterySoc, total: 100, type: ProgressType.Linear })
.width('22.5vp')
.height('100%')
//todo 先设置为0
.backgroundColor("#00ffffff")
//如果宽不写死大小,right会失效
.padding({ left: 1.5, top: 1.5, right: 3, bottom: 1.5 })
.style({ strokeRadius: 0, strokeWidth: 5, enableSmoothEffect: false });
}
.width("22.5vp")
.height("10vp");
}
.width('100%')
.height("12vp")
.margin({ bottom: 30 })
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.End);
} 1
3
浏览468 发布于2024-06-19 09:56北京
全部评论
最多点赞
最新发布
最早发布
暂无评论
写回答
所见即所得编辑器, editor1
工具栏
0/50000
新增插入模板功能
一键使用模板,快速填写内容,轻松发帖~
知道了
- 为了保障您的信息安全,请勿上传您的敏感个人信息(如您的密码等信息)和您的敏感资产信息(如关键源代码、签名私钥、调试安装包、业务日志等信息),且您需自行承担由此产生的信息泄露等安全风险。
- 如您发布的内容为转载内容,请注明内容来源。
我要提问题
了解社区公约,与您携手共创和谐专业的开发者社区。





































苏公安网备 32011402010933号