我正在尝试将 FormItem 用作 DataGroup 中的 ItemRenderer - 目的是基于 XMLlist 作为数据提供者动态创建表单。第一部分是成功的,因为表单项已成功呈现,但是我的问题是,尽管在 DataGroup 中使用了 FormLayout,但我的 FormItem 标签没有相互对齐。
<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955" minHeight="600"
>
<fx:Declarations>
<fx:XMLList id="_formModel" >
<control description="Weeks 1 Form Item" id="087B4626-B95E-731F-ACC7-80ED7373E083" label="One" />
<control description="Weeks 2 Form Item" id="AC546361-D9C5-E9F3-5F90-80EFA52EF54D" label="Second" />
<control description="Weeks 3 Form Item" id="9EE2AAA4-B9C3-68C0-D9B5-80F0374F940E" label="Three" />
<control description="Weeks 4 Form Item" id="3CCEABD6-12F9-E511-0C77-80F0A86902D5" label="The Fourth" />
</fx:XMLList>
<s:XMLListCollection id="_controls" source="{_formModel}"/>
</fx:Declarations>
<s:Scroller width="100%" height="100%">
<s:DataGroup width="100%" height="100%" dataProvider="{_controls}" >
<s:layout>
<s:FormLayout/>
</s:layout>
<s:itemRenderer>
<fx:Component>
<s:ItemRenderer>
<s:FormItem label="{data.@label}" width="100%" >
<s:TextInput width="100%" text="{data.@description}"/>
</s:FormItem>
</s:ItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:DataGroup>
</s:Scroller>
</s:Application>
谁能告诉我如何对齐表单项标签,同时仍在数据组中使用它们,因为练习的目的是根据输入数据组的数据动态创建表单。
提前致谢。