UI布局学习 之 相对布局 (RelativeContainer)
一、关键字 RelativeContainer, alignRules(适配规则)
Text('Text02')
.alignRules({
left: { anchor: 'text01', align: HorizontalAlign.Start },
top: { anchor: 'text01', align: VerticalAlign.Bottom },
bottom: { anchor: 'text01', align: VerticalAlign.Bottom },
right: { anchor: 'text01', align: HorizontalAlign.End }
})
- 其实很好理解 :alignRules{}里面表示:
- 元素四个方向(left,top,bottom,right),
- 相对于谁(anchor:‘id’)
- 的什么位置(HorizontalAlign.Start ,VerticalAlign.Bottom ,VerticalAlign.Bottom, HorizontalAlign.End )
RelativeContainer为采用相对布局的容器,支持容器内部的子元素设置相对位置关系。子元素支持指定兄弟元素作为