【发布时间】:2013-06-25 14:54:29
【问题描述】:
在我的应用程序中,我导入了一个 Twitter 时间线。有些推文包含图像,有些则没有。 imqages 的高度也是可变的。我设置了 90% 的宽度以确保图像适合组(使用垂直布局),但无论我做什么,组都会从原始图像获取高度,而不是缩放高度。我尝试设置 variableRowHeight="true",但这似乎没有任何作用。这是一些示例代码:
<s:List id="list" y="0" width="90%" height="954" dataProvider="{tweets}" horizontalCenter="0">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<s:itemRenderer>
<fx:Component>
<s:ItemRenderer>
<s:Group width="100%">
<s:Label id="twitlabel" text="{tweetImage.height}"
width="100%"
styleName="tweetlist"/>
<s:Image id="tweetImage" y="{twitlabel.height}" width="90%" horizontalCenter="0" scaleMode="letterbox" smooth="true" source="{data.entities.media[0].media_url}"/>
</s:Group>
</s:ItemRenderer>
</fx:Component>
</s:itemRenderer>
问题是,如何让组将其高度设置为缩放后的图像高度?
【问题讨论】:
-
试试这个:
<s:VerticalLayout horizontalAlign="justify" useVirtualLayout="false" variableRowHeight="true" /> -
感谢您的回复,但这并没有奏效,仍然在该组的项目中出现了巨大的差距。另外,当我将 Image 类设置为 BitmapImage 时,它可以工作,但有时图像不显示(但组与图像一样大)。
标签: image actionscript-3 apache-flex flash-builder