跳到主要内容

eui.RowAlign

   eui

   public class RowAlign

RowAlign 类为 TileLayout 类的 rowAlign 属性定义可能的值。

公共属性

属性
JUSTIFY_USING_GAP : string
[静态]通过增大垂直间隙将行两端对齐
JUSTIFY_USING_HEIGHT : string
[静态]通过增大行高度将行两端对齐
TOP : string
[静态]不进行两端对齐

属性详细信息

JUSTIFY_USING_GAP

JUSTIFY_USING_GAP : string = "justifyUsingGap"

  • 支持版本:eui 1.0
  • 运行平台:Web,Native

通过增大垂直间隙将行两端对齐。

JUSTIFY_USING_HEIGHT

JUSTIFY_USING_HEIGHT : string = "justifyUsingHeight"

  • 支持版本:eui 1.0
  • 运行平台:Web,Native

通过增大行高度将行两端对齐。

TOP

TOP : string = "top"

  • 支持版本:eui 1.0
  • 运行平台:Web,Native

不进行两端对齐。

示例

**

* 以下示例使用 RowAlignExample 类来演示 TileLayout 类的 rowAlign 可定义的值

*/

class RowAlignExample extends egret.Sprite {

constructor() {

super();

this.once(egret.Event.ADDED_TO_STAGE, this.init, this);

}

private init(): void {

var arrAlign = [eui.RowAlign.TOP, eui.RowAlign.JUSTIFY_USING_GAP, eui.RowAlign.JUSTIFY_USING_HEIGHT];

for (var i = 0, max = arrAlign.length; i < max; i++) {

var group = new eui.Group();

group.width = 300;

group.height = 180;

group.y = i*250;

this.addChild(group);

var layout = new eui.TileLayout();

layout.rowAlign = arrAlign[i];

layout.requestedColumnCount = 3;

group.layout = layout;

var txt = this.getTxt(arrAlign[i]);

txt.x = 310;

txt.y = i*250;

this.addChild(txt);

for (var j = 0; j < 6; j++) {

var btn = this.getButton();

btn.percentWidth = 100;

btn.percentHeight = 100;

group.addChild(btn);

}

}

}

private getTxt(value: string): egret.TextField {

var txt = new egret.TextField;

txt.text = value;

txt.textColor = 0xffffff;

return txt;

}

private getButton(): eui.Button {

var exml =

`<e:Skin class="skins.ButtonSkin" states="up,down,disabled" minHeight="50" minWidth="100" xmlns:e="http:/ns.egret.com/eui">

<e:Image source="resource/button_up.png" source.down="resource/button_down.png" scale9Grid="1,3,8,8" width="100%" height="100%"/>

<e:Label id="labelDisplay" top="8" bottom="8" left="8" right="8" size="20" fontFamily="Tahoma" textColor="0xFFFFFF" verticalAlign="middle" textAlign="center"/>

</e:Skin>`;

var clazz = EXML.parse(exml);

var btn = new eui.Button();

btn.skinName = "skins.ButtonSkin";

return btn;

}

}