Posts Tagged ‘UIComponent’

  • Adobe是这样说的:

    Specifies whether this component is included in the layout of the parent container.
    If true, the object is included in its parent container’s layout.
    If false, the object is positioned by its parent container as per its layout rules, but it is ignored for the purpose of computing the position of the next child.

    The default value is true.

    This property can be used as the source for data binding.

    很多时候,这个属性可以实现的功能,有些类似于CSS中的display:block/none

    但是,在Flex中,将includeInLayout设置为false,并不代表从“布局”中“隐藏”掉这个UIComponent,而仅仅是将这个UIComponent从布局中忽略,直接布局下一个对象。

    如果想完全从容器中隐藏掉一个对象,请同时使用visible=”false” includeInLayout=”false”

    请参阅下面三个设置了includeInLayout的Panel的例子

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
    	<mx:Panel>
    		<mx:TextInput/>
    		<mx:TextInput includeInLayout="false"/>
    		<mx:TextInput/>
    	</mx:Panel>
    	<mx:Panel>
    		<mx:TextInput/>
    		<mx:TextInput visible="false" includeInLayout="false"/>
    		<mx:TextInput/>
    	</mx:Panel>
    	<mx:Panel>
    		<mx:TextInput/>
    		<mx:TextInput includeInLayout="false"/>
    	</mx:Panel>
    </mx:Application>

    运行效果: