从Flex 4 SDK文档(link text):
“的默认宽度和高度的ViewStack容器是第一个孩子的宽度和高度ViewStack容器不每次你改变的时候改变大小。 。活跃的孩子
您可以使用以下方法来控制ViewStack容器的大小,使其显示其子里面所有的组件:
1. Set explicit width and height properties for all children to the same fixed values.
2. Set percentage-based width and height properties for all children to the same fixed values.
3. Set width and height properties for the ViewStack container to a fixed or percentage-based value.
您使用的技术是基于你的AP折磨和你的ViewStack容器的内容。“
为了解决这个问题,您可以在导航器内容中添加一个滚动条。代码可能看起来像这样:
<?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>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:TabBar dataProvider="{myselfViewStack}"/>
<mx:ViewStack id="myselfViewStack" left="0" right="0" top="100" bottom="0">
<s:NavigatorContent>
<s:Scroller width="100%" height="100%">
<s:Group>
<!-- scrollbar not shown -->
<s:Group width="100%" height="100">
<s:Label text="1"/>
</s:Group>
</s:Group>
</s:Scroller>
</s:NavigatorContent>
<s:NavigatorContent>
<s:Scroller width="100%" height="100%">
<s:Group>
<!-- scrollbar shown -->
<!-- Explicit height set in group to "simulate" content -->
<s:Group width="100%" height="1500">
<s:Label text="2"/>
</s:Group>
</s:Group>
</s:Scroller>
</s:NavigatorContent>
<s:NavigatorContent>
<s:Label text="3"/>
</s:NavigatorContent>
</mx:ViewStack>
</s:Application>
我需要滚动条与其他视图一起工作。所以我必须设置宽度和高度......但我不知道总高度...... – chchrist 2010-11-30 21:12:41