Flex4向应用程序添加滚动条
我正在尝试创建一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对我来说同样的问题,我也遵循相同的教程。如果我将horizontalScrollPolicy =“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.
在index.html文件中,在样式声明中,粘贴以下代码,
我希望它应该有效。如果屏幕尺寸小于800X600,应该出现滚动条。
In index.html file, within style declaration, paste following code,
i hope it should works.Scroll bar should appear if screen size less than 800X600.