当前位置:网站首页>openharmony容器组件之Column
openharmony容器组件之Column
2022-08-09 13:12:00 【lplj717】
Column:沿垂直方向布局的容器
Column(value:{space?: Length}) //space:纵向布局元素间距,默认为0
Column属性:
1,alignItems(设置子组件在水平方向上的对齐格式)
2,justifyContent8+(设置子组件在垂直方向上的对齐格式)
直接上图:

上代码:
@Entry
@Component
struct ColumnT {
build() {
Column() {
Text('space').fontSize(9).fontColor(0x000000).width('90%')
//space:纵向布局元素间距
Column({ 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:设置子组件在水平方向上的对齐格式(属性有:Start,Center,End),默认Center
Column({ 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:设置子组件在垂直方向上的对齐格式
Column() {//注意:此处不能添加space属性,添加之后justifyContent属性失效(基于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%')
}
}边栏推荐
- Professor Chen Qiang "application in machine learning and R" course chapter 17
- The sword refers to Offer 57 - II. and is a continuous positive sequence of s (sliding window)
- 哈希表卡片
- WPF 系统托盘 图标闪烁
- 32位机器和64位机器基本数据类型长度
- 音频基础学习——声音的本质、术语与特性
- Q_06_05 文件结构
- opencv-matchTemplate 之使用场景为大图里面找小图
- render解析
- 现在40系显卡都快出来了,为何1060型号的显卡还有这么多人用?
猜你喜欢
随机推荐
pyautogui的简单操作(2)-弹窗操作
富媒体在客服IM消息通信中的秒发实践
JS轮播图实现
初中级常见面试题
RobotFramework 之 用户关键字
Professor Chen Qiang's "Machine Learning and R Application" course Chapter 13 Assignment
Q_04_05 使用Qubits
Professor Chen Qiang's "Machine Learning and R Application" course Chapter 14 Assignment
Q_06_04 语句和其他构造
搭建大型分布式服务(二)搭建会员服务
Professor Chen Qiang "application in machine learning and R" course chapter 17
微信实现扫码支付(native)
对百度的内容进行修改
MySQL主从同步原理
FFmpeg长时间无响应的解决方法
JS本地存储 sessionStorage和localStorage
Unity3d_API_GPS_LocationService
IDEA Gradle 常遇问题(一)
RobotFramework 之 RF变量与标准库关键字使用
GIN Bind mode to get parameters and form validation


![[极客大挑战 2019]Upload](/img/ed/062a89797c790189d9bd77b50335b0.png)






