垂直排列在彎曲的形式佈局Flex的形式佈局 - 添加的第一個孩子與標籤
<mx:Form id="form">
<mx:FormItem label="horizontal:">
<mx:Text text="test"/>
</mx:FormItem>
</mx:Form>
輸出將是
水平「測試」
但我的約束是我要對齊的文本框(表單項的第一個子項)與標籤垂直。我如何做到這一點?任何輸入邀請
垂直排列在彎曲的形式佈局Flex的形式佈局 - 添加的第一個孩子與標籤
<mx:Form id="form">
<mx:FormItem label="horizontal:">
<mx:Text text="test"/>
</mx:FormItem>
</mx:Form>
輸出將是
水平「測試」
但我的約束是我要對齊的文本框(表單項的第一個子項)與標籤垂直。我如何做到這一點?任何輸入邀請
你可以通過覆蓋updateDisplayList方法來覆蓋form/formitem類來更改佈局方法。
您也可以嘗試這樣的事:
<mx:Form id="form">
<mx:FormItem direction="vertical">
<mx:Label text="horizontal:"/>
<mx:Text text="test"/>
</mx:FormItem>
</mx:Form>
用於火花形式它的工作方式不同。看看這很好的說明:https://opensource.adobe.com/wiki/display/flexsdk/Spark+Form
從上述來源:
<fx:Style>
@namespace s "library://ns.adobe.com/flex/spark";
#stackedForm s|FormItem
{
skinClass : ClassReference("spark.skins.spark.StackedFormItemSkin");
}
</fx:Style>
<s:Form id="stackedForm">
<s:FormItem label="Address" sequenceLabel="1." required="true" >
<s:TextInput width="100%"/>
<s:TextInput width="100%"/>
<s:TextInput width="100%"/>
<s:helpContent>
<s:Label text="(ex. 123 Main Street)" baseline="24"/>
<s:Button label="?" width="30" baseline="24" x="120"/>
</s:helpContent>
</s:FormItem>
<s:FormItem label="City" sequenceLabel="2." required="true">
<s:TextInput width="100%"/>
</s:FormItem>
<s:FormItem label="State" sequenceLabel="3.">
<s:ComboBox dataProvider="{statesDP}" width="100%"/>
</s:FormItem>
<s:FormItem label="ZipCode" sequenceLabel="4." required="true">
<s:TextInput widthInChars="4" restrict=""/>
<s:helpContent>
<s:Label text="Will appear in your profile" left="0" right="0" baseline="24"/>
</s:helpContent>
</s:FormItem>
</s:Form>
u能提供我一些更多的投入。我看了看源...,但不能跟蹤它。你能否提供我重寫的代碼示例..謝謝! – user454535 2010-09-22 02:50:02
瞭解Flex組件生命週期。逐步完成生命週期方法。 「CreateChildren,commitProperties,updatedisplayList和measure。查看代碼,找出它的作用,看看是否可以改變它。 – JeffryHouser 2010-09-22 03:09:36