当前位置:网站首页>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%')
}
}边栏推荐
猜你喜欢
随机推荐
NC7 买卖股票的最好时机(一)
JS动画函数封装
易语言获取cookie
Final assignment of R language data analysis in a university
Record the system calls and C library functions used in this project-2
pytest 之 allure报告
关于做2D游戏时,Canvas边界显示在Game窗口的问题
企业公众号开通微信支付
The sword refers to the offer, cuts the rope 2
什么是布隆过滤器?如何使用?
Professor Chen Qiang's "Machine Learning and R Application" course Chapter 15 Homework
javscript基础易错点集合
pytest 筛选用例
pytest 之 fixture参数化
蓝桥历届真题-蛇形填数
一篇ngork直接使用
【NVIDIA】Tesla V100安装NVIDIA-Driver驱动程序适配CUDA-Toolkit-11.6
Q_08 更多信息
Professor Chen Qiang's "Machine Learning and R Application" course Chapter 14 Assignment
机器学习web服务化实战:一次吐血的服务化之路 (转载非原创)


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






