Spark Scroller,限制垂直滚动

时间:2010-12-29 09:04:55

标签: flex actionscript flex4 scroll scroller

我的视图中有一个Spark Scroller因为我有很多内容并需要垂直滚动。我目前有一些标签从我的dataProvider获取数据,字符串有时很长。我希望标签是多行的,但由于所有内容都在滚动器中同时进行x和y滚动,因此标签从不使用maxDisplayedLines属性并将整个视口拉伸到所需的大小。

<s:Scroller left="10" right="10" top="10" bottom="0">
 <s:Group>
  <s:VGroup>
   <s:HGroup>
    <s:Label text="Name: "/>
    <s:Label text="{data.name}"/>
   </s:HGroup>
   <s:HGroup>
    <s:Label text="Description: "/>
    <s:Label text="{data.description}" maxDisplayedLines="-1"/> // This pushes everything out, I want it to not expand the content horizontally beyond the width
   </s:HGroup>
   ...
  </s:VGroup>
 </s:Group>
</s:Scroller>

感谢任何帮助。感谢。

2 个答案:

答案 0 :(得分:2)

使用水平滚动策略=“of”

答案 1 :(得分:2)

您需要在容器/组件上建立宽度,以便正确测量。这对我有用:

<s:Scroller left="10" right="10" top="10" bottom="0">
 <s:Group width="100%">
  <s:VGroup width="100%">
   <s:HGroup width="100%">
    <s:Label text="Name: "/>
    <s:Label text="{data.name}"/>
   </s:HGroup>
   <s:HGroup width="100%">
    <s:Label text="Description: "/>
    <s:Label width="100%" text="{data.description}" maxDisplayedLines="-1"/> // This pushes everything out, I want it to not expand the content horizontally beyond the width
   </s:HGroup>
   ...
  </s:VGroup>
 </s:Group>
</s:Scroller>
相关问题