Flex中如何隐藏组件并且不占空间

只要设置visible="false" includeInLayout="false" 就好了
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
	<mx:VBox width="100%">
		<mx:HBox width="800" height="100%">
			<mx:Button label="test1" width="300" visible="false"/>
			<mx:Button label="test2" width="300" />
		</mx:HBox>
		
		<mx:HBox width="800" height="100%">
			<mx:Button label="test3" width="300" visible="false" includeInLayout="false"/>
			<mx:Button label="test4" width="300" />
		</mx:HBox>
	</mx:VBox>
</mx:Application>

你可能感兴趣的:(xml,Flex)