当前位置:网站首页>openharmony容器组件之Row
openharmony容器组件之Row
2022-08-09 13:12:00 【lplj717】
Row:沿水平方向布局的容器
Row(value:{space?: Length}) //space:横向布局元素间距,默认为0
Row属性:
1,alignItems(在垂直方向上子组件的对齐格式)
2,justifyContent8+(设置子组件在水平方向上的对齐格式)
上代码:
@Entry
@Component
struct ColumnT {
build() {
Column() {
Text('space').fontSize(9).fontColor(0x000000).width('90%')
//space:横向布局元素间距
Row({ space: 5 }) {
Text().width('30%').height(30).backgroundColor(0xAFEEEE)
Text().width('30%').height(30).backgroundColor(0x00FFFF)
}.width('90%').height(80).border({ width: 1 })
Text('alignItems').fontSize(9).fontColor(0x000000).width('90%')
//alignItems:在垂直方向上子组件的对齐格式(属性有:Start,Center,End),默认(Center)
Row({ space: 5 }) {
Text().width('30%').height(30).backgroundColor(0xAFEEEE)
Text().width('30%').height(30).backgroundColor(0x00FFFF)
}.alignItems(VerticalAlign.Center).width('90%').height(80).border({ width: 1 })
Text('justifyContent').fontSize(9).fontColor(0x000000).width('90%')
//justifyContent:设置子组件在水平方向上的对齐格式
Row() { //注意:此处不能添加space属性,添加之后justifyContent属性失效(基于sdk8)
Text().width('30%').height(30).backgroundColor(0xAFEEEE)
Text().width('30%').height(30).backgroundColor(0x00FFFF)
}.width('90%').height(80).border({ width: 1 }).justifyContent(FlexAlign.End)
}
.width('100%')
.height('100%')
}
}
边栏推荐
猜你喜欢
随机推荐
GIN Bind mode to get parameters and form validation
NC15 求二叉树的层序遍历
group by的工作原理和优化思路
R language kaggle game data exploration and visualization
分布式系统关注点(8)——99%的人都能看懂的「熔断」以及最佳实践 (转载非原创)
ArcEngine(十)创建矢量图层
RobotFramework 之 库与关键字
WPF 系统托盘 图标闪烁
Q_06_05 文件结构
tkiner组件之滚动文本框(scrolledtext )相关操作
The sword refers to Offer 57 - II. and is a continuous positive sequence of s (sliding window)
初中级常见面试题
FFmpeg相机花屏花图问题解决方法
什么是布隆过滤器?如何使用?
RobotFramework 之 数据驱动
二叉树的遍历(py)
目标检测类间不平衡问题
Ledong Fire Rescue Brigade was invited to carry out fire safety training for cadres
Sql之各种Join
面试攻略系列(四)-- 你不知道的大厂面试