Actionscript 3 如何在滚动条中显示具有动态大小的标签
我的一个应用程序中的标签显示有问题 我有一个显示标签的视图。此标签的文本可以随时更新,并且此文本可以由一个单词组成,因为它可以是带有一些换行符的长文本 如果整个文本可以放在父视图中,我希望它垂直居中。 如果它太长,不适合,我想显示一个滚动条 所以我使用了一个Actionscript 3 如何在滚动条中显示具有动态大小的标签,actionscript-3,apache-flex,scroller,Actionscript 3,Apache Flex,Scroller,我的一个应用程序中的标签显示有问题 我有一个显示标签的视图。此标签的文本可以随时更新,并且此文本可以由一个单词组成,因为它可以是带有一些换行符的长文本 如果整个文本可以放在父视图中,我希望它垂直居中。 如果它太长,不适合,我想显示一个滚动条 所以我使用了一个滚动条: <s:Scroller left="5" top="50" right="5" bottom="5"> <s:Group> <s:Label id="description"
滚动条:
<s:Scroller left="5" top="50" right="5" bottom="5">
<s:Group>
<s:Label id="description" text="{hostComponent.description}"
width="100%" verticalCenter="0"/>
</s:Group>
</s:Scroller>
如果文本较短,则标签按预期居中,但当文本足够长,可以显示scollbar时,我看不到第一行(9)
如果我省略了verticalCenter=“0”
,则长文本将显示良好,但短文本不再垂直居中
有人对我的问题有解释和/或解决方案吗?尝试使用HGroup:
<s:Scroller id="scroller" left="5" top="50" right="5" bottom="5">
<s:HGroup verticalAlign="middle" width="100%" height="100%">
<s:Label id="description" text="{hostComponent.description}"
width="100%"/>
</s:HGroup>
</s:Scroller>
尝试使用HGroup:
<s:Scroller id="scroller" left="5" top="50" right="5" bottom="5">
<s:HGroup verticalAlign="middle" width="100%" height="100%">
<s:Label id="description" text="{hostComponent.description}"
width="100%"/>
</s:HGroup>
</s:Scroller>