Flex中通过horizontalAlign和verticalAlign样式调整Tile容器横向和竖向对齐方式的例子
By Minidxer | August 3, 2008
接下来的例子演示了Flex中如何通过horizontalAlign和verticalAlign样式,调整Tile容器横向和竖向对齐方式。
让我们先来看一下Demo(可以右键View Source或点击这里察看源代码):
下面是完整代码(或点击这里察看):
Download: main.mxml
- <?xml version="1.0" encoding="utf-8"?>
- <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
- layout="vertical"
- verticalAlign="middle"
- backgroundColor="white">
- <mx:ApplicationControlBar dock="true">
- <mx:Label text="horizontalAlign:" />
- <mx:ComboBox id="hAlign">
- <mx:dataProvider>
- <mx:String>left</mx:String>
- <mx:String>center</mx:String>
- <mx:String>right</mx:String>
- </mx:dataProvider>
- </mx:ComboBox>
- <mx:Spacer width="100" />
- <mx:Label text="verticalAlign:" />
- <mx:ComboBox id="vAlign">
- <mx:dataProvider>
- <mx:String>top</mx:String>
- <mx:String>middle</mx:String>
- <mx:String>bottom</mx:String>
- </mx:dataProvider>
- </mx:ComboBox>
- </mx:ApplicationControlBar>
- <mx:Tile id="tile"
- backgroundColor="haloSilver"
- tileHeight="50"
- tileWidth="50"
- horizontalAlign="{hAlign.selectedItem}"
- verticalAlign="{vAlign.value}">
- <mx:VBox width="30" height="30" backgroundColor="red" />
- <mx:VBox width="30" height="30" backgroundColor="red" />
- <mx:VBox width="30" height="30" backgroundColor="red" />
- <mx:VBox width="30" height="30" backgroundColor="red" />
- <mx:VBox width="30" height="30" backgroundColor="red" />
- <mx:VBox width="30" height="30" backgroundColor="red" />
- <mx:VBox width="30" height="30" backgroundColor="red" />
- </mx:Tile>
- </mx:Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子
Topics:
Flex |
No Comments » |
326 views
Tags: horizontalAlign, Tile, verticalAlign, 对齐方式