当前位置:网站首页>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%')
}
}
边栏推荐
猜你喜欢
随机推荐
Oracle Recovery Tools修复空闲坏块
GIN file upload and return
FFmpeg av_interleaved_write_frame错误
神经网络与深度学习(TensorFlow)
群组行动控制--自动队列化实现策略
CutefishOS系统默认自动桌面壁纸
音频基础学习——声音的本质、术语与特性
RobotFramework 之 Setup和Teardown
Q_04_07 进一步探索
面试攻略系列(二)-- 秒杀系统
pytest 与 unittest 的区别
Q_06_02 类型模型
FFmpeg multimedia file processing (the basic concept of ffmpeg processing stream data)
19、学习MySQL 索引
Final assignment of R language data analysis in a university
Time series analysis course lab report
ArcEngine(九)图形绘制
缓存和数据库一致性问题
01_iTween_第一天--小球抛物线
npm install失败