指定列的对齐方式 有三个值(left ??justifyUsingWidth?justifyUsingGap)
设置为?ColumnAlign.LEFT
?时,它会关闭列两端对齐。在容器的最后一列和右边缘之间可能存在部分可见的列或空白。这是默认值。
设置为?ColumnAlign.JUSTIFY_USING_GAP
?时,horizontalGap
?的实际值将增大,这样最后一个完全可见列右边缘会与容器的右边缘对齐。仅存在一个完全可见列时,horizontalGap
?的实际值将增大,这样它会将任何部分可见列推到容器的右边缘之外。请注意显式设置?horizontalGap
?属性不会关闭两端对齐。它仅确定初始间隙值。两端对齐可能会增大它。
设置为?ColumnAlign.JUSTIFY_USING_WIDTH
?时,columnWidth
?的实际值将增大,这样最后一个完全可见列右边缘会与容器的右边缘对齐。请注意显式设置?columnWidth
?属性不会关闭两端对齐。它仅确定初始列宽度值。两端对齐可能会增大它。
代码如下:
<s:BorderContainer width="1330" height="530" borderColor="#F70606" borderWeight="2">
<s:layout>
<s:TileLayout verticalGap="2" horizontalGap="2" requestedColumnCount="3" requestedRowCount="3" columnAlign="justifyUsingWidth" rowAlign="justifyUsingHeight"/>
</s:layout>
<mx:VideoDisplay contentBackgroundColor="0x666666"/>
<mx:VideoDisplay contentBackgroundColor="0x666666"/>
<mx:VideoDisplay contentBackgroundColor="0x666666"/>
<mx:VideoDisplay contentBackgroundColor="0x666666"/>
<mx:VideoDisplay contentBackgroundColor="0x666666"/>
<mx:VideoDisplay contentBackgroundColor="0x666666"/>
<mx:VideoDisplay contentBackgroundColor="0x666666"/>
<mx:VideoDisplay contentBackgroundColor="0x666666"/>
<mx:VideoDisplay contentBackgroundColor="0x666666"/>
</s:BorderContainer>
veriticalGap=2 表示行之间的间距为2个像素
horizontalGap=2 表示列之间的间距为2个像素
requestedColumnCount=2 表示2列
requestedRowCount=2 ?表示2行
columnAlign=justifyUsingWidth ?宽自适应
columnHeight=justifyUsingHeight ?高自适应
效果图:
注:这个布局有个不算问题的问题,就是当容器内某个组件的大小大于容器的自适应大小的时候,则所有的容器都会按这个大小布局,如上面的例子,容器的宽是1530,1330/3=443,530/3=176 也就是说他们自适应的宽高大概等于510*176,如果你某个组件的宽高大于这个值的话,那么所有的组件都会等于最大的那个值