[英]Flex - percentage height
如何限制高度/宽度百分比为100%的子容器的大小?
例:
<mx:HBox id="container" width="100%" height="100%">
<mx:HBox id="scrollContainer" width="100%" height="100%">
<!-- keep this content limited to the size of "container" -->
<!-- I also want to use the scollers from "scrollContainer" -->
</mx:HBox>
</mx:HBox>
现在,“ scrollContainer”中的内容一旦大于“ container”,就会溢出
编辑
显然,如果我将HBox更改为Canvas,则可以得到所需的行为,但是我仍然想知道如何使用HBox完成此操作以及为什么它不同于Canvas。
如果将外部HBox上的verticalScrollPolicy和horizontalScrollPolicy设置为“ off”,则可能可以执行此操作。 用单个顶级HBox更好地完成这种事情-存在HBoxes可以为您的控件提供水平布局,因此将一个嵌套在另一个控件中以100%嵌套可以为您提供两个嵌套级别,而没有任何功能上的区别。
与Canvas相比,您的Canvas解决方案听起来比您最初要求的布局要好,因为Canvas是一种更轻便的控件,但是如果您在其中没有其他子控件,它仍然无法为您做任何事情那里。
maxHeight,maxWidth属性
并回答您的其他问题。
画布-设置X和Y的对象的子对象绝对位置
HBox,VBox-子代定位基于父代(HBox,VBox)对于HBox,VBox如果在子代上设置x或y,则不会发现任何更改,父代会覆盖它。
我认为您应该可以通过这样设置宽度来做到这一点:
<mx:HBox id="container" width="100%" height="100%">
<mx:HBox id="scrollContainer" width="{container.width}" height="{container.height}">
<!-- keep this content limited to the size of "container" -->
<!-- I also want to use the scollers from "scrollContainer" -->
</mx:HBox>
</mx:HBox>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.