繁体   English   中英

Flex mx:图像适合屏幕

[英]Flex mx:image fit in screen

我有一些带有图像的布局,我希望该布局自动适合屏幕(这就是为什么我使用100%),但是当我加载大图像时,它超出了屏幕(实际上我可以设置mx:Image maxHeight =“”,但这对于不同的屏幕分辨率,值将不相同)

我的布局示例:

    <s:VGroup>              
        <s:BorderContainer borderStyle="solid"  width="100%" height="100%>
            <s:Scroller left="2" right="2" top="2" bottom="2">
                <s:Group id="group"> 
                    <mx:Image id="currImg" />
                </s:Group>
            </s:Scroller>   
        </s:BorderContainer>
         <!-- .....  -->
        </s:VGroup>

更新:最适合我的解决方案

<s:VGroup width="100%" height="100%">               
   <s:BorderContainer  borderStyle="solid"  width="100%" height="100%">
    <s:Scroller left="2" right="2" top="2"  bottom="2"maxWidth="{mx.core.FlexGlobals.topLevelApplication.widht}"  maxHeight="{mx.core.FlexGlobals.topLevelApplication.height}">
       <s:Group id="group" > 
        <mx:Image id="currImg" />

您需要将所有容器的高度/宽度设置为100%。

<s:VGroup width="100%" height="100%">              
   <s:BorderContainer borderStyle="solid"  width="100%" height="100%">
      <s:Scroller left="2" right="2" top="2" bottom="2">

                    <mx:Image id="currImg" width="100%" height="100%" scaleContent="true" />
      </s:Scroller>   
   </s:BorderContainer>
</s:VGroup>

假设您希望Image与应用程序的大小相同(并假设您使用的是Flex 4),则可以使用:

maxHeight="{FlexGlobals.topLevelApplication.height}"

这会将您的图片的最大高度设置为与应用程序相同的高度。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM