Spark Scroller,限制垂直滚动

发布于 2024-10-09 17:04:02 字数 754 浏览 9 评论 0原文

我的视图中有一个 Spark Scroller,因为我有很多内容并且需要垂直滚动。我当前有一些标签从我的 dataProvider 获取数据,并且字符串有时很长。我希望标签是多行的,但由于当前所有内容都位于同时进行 x 和 y 滚动的 Scroller 中,因此标签从不使用 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>

任何帮助表示赞赏。谢谢。

I have a Spark Scroller within my View because I have a lot of content and require vertical scrolling. I current have some labels that get data from my dataProvider, and the strings are sometimes long. I'd like the label to be multiline, but because everything is currently in a Scroller that does both x and y scrolling, the label never uses the maxDisplayedLines property and stretches the entire viewport out to the required size.

<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>

Any help is appreciated. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

淡水深流 2024-10-16 17:04:02

您需要在容器/组件上确定宽度,以便一切都能正确测量。这对我有用:

<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>

You need to establish a width on your containers/components so it all measures properly. This worked for me:

<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>
吾性傲以野 2024-10-16 17:04:02

使用horizo​​ntalScrollPolicy =“关闭”

Use horizontalScrollPolicy="off"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文