Flex4向应用程序添加滚动条

发布于 2024-10-12 18:32:40 字数 2180 浏览 3 评论 0原文

我正在尝试创建一个 minHeight=600 和 minWidth=800 的登录页面。如果用户将大小调整为较小的分辨率,则只能添加滚动条。我遵循教程< /a>. 代码: Main.xml

<?xml version="1.0"?>
<!-- containers\application\AppSparkScroll.mxml -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
           xmlns:mx="library://ns.adobe.com/flex/mx" 
           xmlns:s="library://ns.adobe.com/flex/spark" 
           minWidth="800" minHeight="600"
           width="100%" height="100%"
           backgroundColor="#292929"
           skinClass="skins.CustomApplicationSkin">

<s:Panel title="Login" id="loginPanel" verticalCenter="0" horizontalCenter="0">

    <mx:Form>

        <mx:FormItem label="Username" width="100%">
            <s:TextInput width="100%" id="username" />
        </mx:FormItem>
        <mx:FormItem label="Password" width="100%">
            <s:TextInput width="100%" displayAsPassword="true" id="password" />
        </mx:FormItem>
        <mx:FormItem>
            <s:Button label="Login" id="loginButton" />
        </mx:FormItem>

    </mx:Form>

</s:Panel>

皮肤.CustomApplicationSkin.mxml

<?xml version="1.0" encoding="utf-8"?>
<!-- containers\application\mySkins\MyAppSkin.mxml -->
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:mx="library://ns.adobe.com/flex/mx" 
    xmlns:s="library://ns.adobe.com/flex/spark">

<fx:Metadata>
    [HostComponent("spark.components.Application")]
</fx:Metadata> 

<s:states>
    <s:State name="normal" />
    <s:State name="disabled" />
</s:states>

<!-- fill -->
<s:Rect id="backgroundRect" left="0" right="0" top="0" bottom="0">
    <s:fill>
        <s:SolidColor color="0xFFFFFF" />
    </s:fill>
</s:Rect>

<s:Scroller height="100%" width="100%">
    <s:Group id="contentGroup" left="0" right="0" top="0" bottom="0" />        
</s:Scroller>
</s:Skin>

I am trying to create a login page with minHeight=600 and minWidth=800. If a user resizes to smaller resolution, only then add scrollbars. I followed tutorial.
Code:
Main.xml

<?xml version="1.0"?>
<!-- containers\application\AppSparkScroll.mxml -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
           xmlns:mx="library://ns.adobe.com/flex/mx" 
           xmlns:s="library://ns.adobe.com/flex/spark" 
           minWidth="800" minHeight="600"
           width="100%" height="100%"
           backgroundColor="#292929"
           skinClass="skins.CustomApplicationSkin">

<s:Panel title="Login" id="loginPanel" verticalCenter="0" horizontalCenter="0">

    <mx:Form>

        <mx:FormItem label="Username" width="100%">
            <s:TextInput width="100%" id="username" />
        </mx:FormItem>
        <mx:FormItem label="Password" width="100%">
            <s:TextInput width="100%" displayAsPassword="true" id="password" />
        </mx:FormItem>
        <mx:FormItem>
            <s:Button label="Login" id="loginButton" />
        </mx:FormItem>

    </mx:Form>

</s:Panel>

skins.CustomApplicationSkin.mxml

<?xml version="1.0" encoding="utf-8"?>
<!-- containers\application\mySkins\MyAppSkin.mxml -->
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:mx="library://ns.adobe.com/flex/mx" 
    xmlns:s="library://ns.adobe.com/flex/spark">

<fx:Metadata>
    [HostComponent("spark.components.Application")]
</fx:Metadata> 

<s:states>
    <s:State name="normal" />
    <s:State name="disabled" />
</s:states>

<!-- fill -->
<s:Rect id="backgroundRect" left="0" right="0" top="0" bottom="0">
    <s:fill>
        <s:SolidColor color="0xFFFFFF" />
    </s:fill>
</s:Rect>

<s:Scroller height="100%" width="100%">
    <s:Group id="contentGroup" left="0" right="0" top="0" bottom="0" />        
</s:Scroller>
</s:Skin>

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

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

发布评论

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

评论(2

最舍不得你 2024-10-19 18:32:40

对我来说同样的问题,我也遵循相同的教程。如果我将horizo​​ntalScrollPolicy =“on”verticalScrollPolicy =“on”添加到滚动条,则可以看到滚动条,但即使浏览器尺寸小于内容尺寸,它们也不起作用。

Same issue to me, I followed the same tutorial either. Could see the scrollers if I add the horizontalScrollPolicy="on" verticalScrollPolicy="on" to the scroller, but they just don't work even if the browser size is smaller than the content size.

抚你发端 2024-10-19 18:32:40

在index.html文件中,在样式声明中,粘贴以下代码,

html, body  {height:100%; width:100%; min-width:800px; min-height:600px; overflow:auto; position:absolute;}

我希望它应该有效。如果屏幕尺寸小于800X600,应该出现滚动条。

In index.html file, within style declaration, paste following code,

html, body  {height:100%; width:100%; min-width:800px; min-height:600px; overflow:auto; position:absolute;}

i hope it should works.Scroll bar should appear if screen size less than 800X600.

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