当前位置:网站首页>Column of openharmony container component

Column of openharmony container component

2022-08-09 14:18:00 lplj717

Column: Container for vertical layout

Column(value:{space?: Length}) //space: vertical layout element spacing, the default is 0
Column property:
1, alignItems (set the alignment format of child components in the horizontal direction)
2, justifyContent8+ (set the vertical alignment of subcomponents)

Directly above:

The code above:

@[email protected] ColumnT {build() {Column() {Text('space').fontSize(9).fontColor(0x000000).width('90%')//space: vertical layout element spacingColumn({ space: 5 }) {Text().width('100%').height(30).backgroundColor(0xAFEEEE)Text().width('100%').height(30).backgroundColor(0x00FFFF)}.width('90%').height(80).border({ width: 1 })Text('alignItems').fontSize(9).fontColor(0x000000).width('90%')//alignItems: Set the alignment format of the sub-component in the horizontal direction (properties are: Start, Center, End), the default CenterColumn({ space: 5 }) {Text().width('50%').height(30).backgroundColor(0xAFEEEE)Text().width('50%').height(30).backgroundColor(0x00FFFF)}.alignItems(HorizontalAlign.Center).width('90%').height(80).border({ width: 1 })Text('justifyContent').fontSize(9).fontColor(0x000000).width('90%')//justifyContent: Set the vertical alignment of the child componentColumn() {//Note: The space attribute cannot be added here, and the justifyContent attribute will be invalid after adding it (based on sdk8)Text().width('50%').height(30).backgroundColor(0xAFEEEE)Text().width('50%').height(30).backgroundColor(0x00FFFF)}.height('15%').border({width:1}).justifyContent(FlexAlign.End)}.width('100%').height('100%')}}

原网站

版权声明
本文为[lplj717]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/221/202208091311594379.html