解决方案如下:@Entry @Component struct TabsKeyPage { @State keys: Array<string> = [] aboutToAppear(): void { for (let i = 0; i < 4; i++) { this.keys.push(i.toString()) } console.log("tag", JSON.stringify(this.keys)); } @Builder tabBuilder(index: number, name: string) { Column() { Text(name) .fontSize(16) .lineHeight(22) .margin({ top: 17, bottom: 7 }) Divider() .strokeWidth(2) .color('#007DFF') } .width('100%') // .height("200") } build() { RelativeContainer() { Tabs() { ForEach(this.keys, (item: string, index: number) => { TabContent() { Text("AAAAAAAAAAAAA").width("100%").fontColor(Color.Green).fontSize(30).height("100%") } .tabBar(this.tabBuilder(0, 'green')) }) } .barHeight(200) // .height('100%') .width('100%') .backgroundColor(Color.White) } .height('100%') .width('100%') } }设置barHeight的值可改变高度,但要注意其他注释的height,如果设置了,该值无效。关于barHeight的说明规则请参考:https://developer.huawei.com/consumer/cn/doc/harmonyos-refere...还有一些其他实现方法也可参考:https://developer.huawei.com/consumer/cn/forum/topic/02031421...
解决方案如下:
设置barHeight的值可改变高度,但要注意其他注释的height,如果设置了,该值无效。
关于barHeight的说明规则请参考:https://developer.huawei.com/consumer/cn/doc/harmonyos-refere...
还有一些其他实现方法也可参考:https://developer.huawei.com/consumer/cn/forum/topic/02031421...