0

有没有办法让滚动条内的组件内容达到 100% 的高度。

这是一个简单的例子:

<s:Scroller width="100%" height="100%">
 <s:viewport>
  <s:Group height="100%">
   <s:Rect width="10" height="500">
    <s:fill>
     <s:SolidColor color="0xFF0000"/>
    </s:fill>
    </s:Rect>
   <s:Rect width="10" x="10" height="100%">
    <s:fill>
     <s:SolidColor color="0x00FF00"/>
    </s:fill>
   </s:Rect>
   <s:Rect width="10" x="20" height="100">
    <s:fill>
     <s:SolidColor color="0x0000FF"/>
    </s:fill>
   </s:Rect>
  </s:Group>
 </s:viewport>
</s:Scroller>

如果你运行这段代码并向下滚动一点,你会得到:

滚动条示例

如您所见,绿色条(设置为 100% 高度)只是使用视口的高度,而不是其父组的高度,红色条将其拉伸为 500px 高。

有没有办法解决这个问题?

4

1 回答 1

0

这是一种解决方法:将组放入另一个组中,然后按预期工作。

于 2010-07-28T15:42:42.853 回答