Adobe Flex 布局问题。 VGroup 内的嵌套容器,100% 高度不起作用
我有一个动态的嵌套布局(大小是百分比值)或者至少应该是动态的。
我从代码中删除了字符串的文本:
<s:VGroup width="98%" height="70%"
horizontalAlign="center"
horizontalCenter="0">
<s:BorderContainer
borderStyle="inset" borderWeight="1"
cornerRadius="20"
textAlign="center"
width="100%" height="100%">
<s:layout>
<s:HorizontalLayout gap="0"
verticalAlign="middle"/>
</s:layout>
<s:Label width="60%" height="100%"
verticalAlign="middle"
textAlign="right"/>
<s:HGroup horizontalAlign="center"
width="40%" height="100%"
gap="0">
<s:Label height="100%" width="100%"
verticalAlign="middle"
textAlign="center"/>
<s:Label height="100%" width="100%"
verticalAlign="middle" />
</s:HGroup>
</s:BorderContainer>
<s:BorderContainer
borderStyle="inset" borderWeight="1"
cornerRadius="20"
textAlign="center"
width="100%" height="100%">
<s:layout>
<s:HorizontalLayout gap="0"
verticalAlign="middle"/>
</s:layout>
<s:Label width="60%" height="100%"
verticalAlign="middle"
textAlign="right"/>
<s:HGroup horizontalAlign="center"
width="40%" height="100%"
gap="0">
<s:Label height="100%" width="100%"
verticalAlign="middle"
textAlign="center"/>
<s:Label height="100%" width="100%"
verticalAlign="middle" />
</s:HGroup>
</s:BorderContainer>
<s:BorderContainer
borderStyle="inset" borderWeight="1"
cornerRadius="20"
textAlign="center"
width="100%" height="100%">
<s:layout>
<s:HorizontalLayout gap="0"
verticalAlign="middle"/>
</s:layout>
<s:Label width="60%" height="100%"
verticalAlign="middle"
textAlign="right"/>
<s:HGroup horizontalAlign="center"
width="40%" height="100%"
gap="0">
<s:Label height="100%" width="100%"
verticalAlign="middle"
textAlign="center"/>
<s:Label height="100%" width="100%"
verticalAlign="middle" />
</s:HGroup>
</s:BorderContainer>
<s:BorderContainer
borderStyle="inset" borderWeight="1"
cornerRadius="20"
textAlign="center"
width="100%" height="100%">
<s:layout>
<s:HorizontalLayout gap="0" />
</s:layout>
<s:Label width="60%" height="100%"
verticalAlign="middle"
textAlign="right"/>
<s:HGroup horizontalAlign="center" verticalAlign="middle"
width="40%" height="100%"
gap="0">
<s:Group width="100%" height="100%">
<s:Rect width="80%" height="80%"
horizontalCenter="0" verticalCenter="0"
bottomLeftRadiusX="15" topRightRadiusX="15">
<s:fill>
<s:SolidColor color="0xFFFFFF" />
</s:fill>
</s:Rect>
<s:Label height="100%" width="100%"
verticalAlign="middle"
textAlign="center"/>
</s:Group>
<s:Label height="100%" width="100%"
verticalAlign="middle" />
</s:HGroup>
</s:BorderContainer>
</s:VGroup>
正如您在图片中看到的,四个“行”太高,无法放入组件(与黑色背景一样大)。
我不知道如何解决这个问题,你有什么提示吗?
这是一个示意性示例: 替代文本 http://www.freeimagehosting.net/uploads/a8159c57d2.png
I have a nested layout which is dynamic (sizes are percentage values) or at least it should be.
I removed the text of the strings from the code:
<s:VGroup width="98%" height="70%"
horizontalAlign="center"
horizontalCenter="0">
<s:BorderContainer
borderStyle="inset" borderWeight="1"
cornerRadius="20"
textAlign="center"
width="100%" height="100%">
<s:layout>
<s:HorizontalLayout gap="0"
verticalAlign="middle"/>
</s:layout>
<s:Label width="60%" height="100%"
verticalAlign="middle"
textAlign="right"/>
<s:HGroup horizontalAlign="center"
width="40%" height="100%"
gap="0">
<s:Label height="100%" width="100%"
verticalAlign="middle"
textAlign="center"/>
<s:Label height="100%" width="100%"
verticalAlign="middle" />
</s:HGroup>
</s:BorderContainer>
<s:BorderContainer
borderStyle="inset" borderWeight="1"
cornerRadius="20"
textAlign="center"
width="100%" height="100%">
<s:layout>
<s:HorizontalLayout gap="0"
verticalAlign="middle"/>
</s:layout>
<s:Label width="60%" height="100%"
verticalAlign="middle"
textAlign="right"/>
<s:HGroup horizontalAlign="center"
width="40%" height="100%"
gap="0">
<s:Label height="100%" width="100%"
verticalAlign="middle"
textAlign="center"/>
<s:Label height="100%" width="100%"
verticalAlign="middle" />
</s:HGroup>
</s:BorderContainer>
<s:BorderContainer
borderStyle="inset" borderWeight="1"
cornerRadius="20"
textAlign="center"
width="100%" height="100%">
<s:layout>
<s:HorizontalLayout gap="0"
verticalAlign="middle"/>
</s:layout>
<s:Label width="60%" height="100%"
verticalAlign="middle"
textAlign="right"/>
<s:HGroup horizontalAlign="center"
width="40%" height="100%"
gap="0">
<s:Label height="100%" width="100%"
verticalAlign="middle"
textAlign="center"/>
<s:Label height="100%" width="100%"
verticalAlign="middle" />
</s:HGroup>
</s:BorderContainer>
<s:BorderContainer
borderStyle="inset" borderWeight="1"
cornerRadius="20"
textAlign="center"
width="100%" height="100%">
<s:layout>
<s:HorizontalLayout gap="0" />
</s:layout>
<s:Label width="60%" height="100%"
verticalAlign="middle"
textAlign="right"/>
<s:HGroup horizontalAlign="center" verticalAlign="middle"
width="40%" height="100%"
gap="0">
<s:Group width="100%" height="100%">
<s:Rect width="80%" height="80%"
horizontalCenter="0" verticalCenter="0"
bottomLeftRadiusX="15" topRightRadiusX="15">
<s:fill>
<s:SolidColor color="0xFFFFFF" />
</s:fill>
</s:Rect>
<s:Label height="100%" width="100%"
verticalAlign="middle"
textAlign="center"/>
</s:Group>
<s:Label height="100%" width="100%"
verticalAlign="middle" />
</s:HGroup>
</s:BorderContainer>
</s:VGroup>
As you see in the picture the four "rows" are too high to fit into the component (which is as big as the black background).
I don't know how to fix this issue, do you have any hints?
This is a schematical example how it looks:
alt text http://www.freeimagehosting.net/uploads/a8159c57d2.png
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的猜测是,您正在尝试使边界容器符合 VGroup 的约束。实现这一目标的一个技巧是在四个 BorderContainer 中的每一个上设置 minHeight="0" 以强制重新测量。如果我在这里偏离了主题,请提供更多关于您具体寻找的结果的信息。希望有帮助。
My guess is that you are trying to make the border containers fit within the constraints of the VGroup. One trick to make that work is to set minHeight="0" on each of the four BorderContainers to force a re-measure. If I'm way off the mark here please provide more information on what result you are looking for specifically. Hope that helps.