当前位置:网站首页>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%')
}
}
边栏推荐
猜你喜欢
pytest 之 fixture的调用
禁止输入(×),按键精灵小程序,快速上手
Spark Sql之join on and和where
tkiner组件之滚动文本框(scrolledtext )相关操作
[极客大挑战 2019]Upload
处理XML,dom4j的简单使用
GIN a preliminary study, the environment is installed
FFmpeg multimedia file processing (the basic concept of ffmpeg processing stream data)
问题系列-如何修改或更新localhost里的值
GIN file upload and return
随机推荐
TCP三次握手和四次挥手及拥塞控制
Professor Chen Qiang's "Machine Learning and R Application" course Chapter 13 Assignment
机器学习web服务化实战:一次吐血的服务化之路 (转载非原创)
对百度的内容进行修改
JS本地存储 sessionStorage和localStorage
Process/Thread related in Sandbox - 1
WPF 系统托盘 图标闪烁
【瑞吉外卖】day05:增、删、改、查分类以及公共字段自动填充
eslint语法规则报错
搭建大型分布式服务(四)Docker搭建开发环境安装Mysql
【NVIDIA】Tesla V100安装NVIDIA-Driver驱动程序适配CUDA-Toolkit-11.6
自己做了个nodejs+epxress+mysql的小项目,怎么才能让别人通过互联网访问呢?
FFmpeg av_interleaved_write_frame错误
JZ7 重建二叉树
初中级常见面试题
行程和用户[阅读理解法]
二叉树的遍历(py)
43. The sword refers to Offer 1 ~ 1 the number of occurrences of n integers (recursive, mathematics)
处理JSON,fastjson、json-lib简单使用
Q_08 更多信息