Flex中如何通过layout属性设置Panel容器横向或竖向排列的例子
By Minidxer | February 22, 2009
接下来的例子演示了Flex中如何通过layout属性,设置Panel容器横向或竖向排列。
让我们先来看一下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:Array id="arr">
- <mx:Object label="horizontal" />
- <mx:Object label="vertical" />
- </mx:Array>
- <mx:ApplicationControlBar dock="true">
- <mx:Form styleName="plain">
- <mx:FormItem label="layout:">
- <mx:ToggleButtonBar id="toggleButtonBar"
- dataProvider="{arr}"
- selectedIndex="1"
- itemClick="panel.layout = event.label;" />
- </mx:FormItem>
- </mx:Form>
- </mx:ApplicationControlBar>
- <mx:Panel id="panel"
- status="{panel.layout}"
- width="320"
- height="160">
- <mx:Label text="Button" />
- <mx:Label text="ButtonBar" />
- <mx:Label text="CheckBox" />
- <mx:Label text="ColorPicker" />
- <mx:Label text="ComboBox" />
- <mx:Label text="DataGrid" />
- <mx:ControlBar>
- <mx:Button label="Submit" />
- <mx:Button label="Cancel" />
- </mx:ControlBar>
- </mx:Panel>
- </mx:Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子
Topics:
Panel |
No Comments » |
1,069 views
Tags: layout, Panel