左右布局候味,文本被自動(dòng)換行
build() {
Flex({
wrap: FlexWrap.NoWrap,
direction: FlexDirection.Row,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Start,
}) {
Text('10:40')
Progress({ type: ProgressType.Linear, value: this.progress, total: 2000 })
// .width('auto')
.backgroundColor(Color.Black)
.flexShrink(0.5)
Text('30:00')
.textOverflow({overflow:TextOverflow.Ellipsis})
.flexShrink(1)
// .flexGrow(2)
}
.width('100%')
.backgroundColor('10000000')
}
解決辦法:利用flexShrink 屬性,表示壓縮比例洪灯,0不壓縮
Text('10:40')
.flexShrink(0)
Progress({ type: ProgressType.Linear, value: this.progress, total: 2000 })
// .width('auto')
.backgroundColor(Color.Black)
.flexShrink(0.5)
Text('30:00')
.textOverflow({overflow:TextOverflow.Ellipsis})
.flexShrink(0)
}