Skip to content
Zhexuan Liu edited this page Jun 21, 2018 · 5 revisions

通用属性

通用属性是指所有控件都可以指定的通用性属性:

名称 作用 可否更改 取值
alignment 控件底部是否需要粘住 superView 的底部 false default, bottom
size 指定如何渲染控件的尺寸 false default: 默认值,使用控件的默认大小,或者指定的大小
stretch: 拉伸控件的高度
hidden 指定控件是否隐藏 true bool 类型,此 attribute 改变时会有伴随有动画

关于 size 与 alignment 每个控件都具有默认高度。将某个 Component 的 size 指定为 stretch 意味它将失去默认的高度而具有 “弹性”。例如: 以下界面具有一个高度自适应的地图和一个 button,对应的 component 代码如下:

<waypointmap size="stretch" type="Edit">
</waypointmap>
<buttongroup alignment="bottom">
  <button type="confirm">Confirm</button>
</buttongroup>

效果如下:

image

但如果将粘底的 buttonGroup 去掉,waypointMap 会由于没有「粘着点」而失去高度,无法显示:

image

此时需要为 waypointMap 本身指定 alignment 属性,则 waypointMap 可以正确全屏显示:

<waypointmap size="stretch" type="Edit" alignment="bottom">
</waypointmap>

image

Clone this wiki locally