Flex 4 - s:滚动
我创建了一个项目,其中包含 mx:ViewStack 作为它的第一个容器。
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comp="mycomp.*"
xmlns:mx="library://ns.adobe.com/flex/mx"
height="100%" width="100%"
minHeight="600" minWidth="800">
<s:layout>
<s:VerticalLayout horizontalAlign="center" />
</s:layout><mx:ViewStack horizontalCenter="0"
verticalCenter="0"
id="contentVs"
height="100%"
width="100%">
<s:NavigatorContent name="biography"
label="Biography"
width="100%"
height="100%">
<comp:Biography />
</s:NavigatorContent>
<s:NavigatorContent name="collections"
label="Collections"
width="100%"
height="100%">
<comp:Collections/>
在 mxViewStack 内的每个 s:NavigatorContent 中,我都有一个自定义 s:SkinnableContainer 组件。在这些组件中,我添加了 as:Scroller 作为第一个子容器。
<?xml version="1.0" encoding="utf-8"?>
<s:SkinnableContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="100%" height="100%"
creationComplete="this_creationCompleteHandler(event)">
<s:Scroller id="scroller1"
width="100%"
height="100%">
<s:Group>
<s:BorderContainer width="100%" height="100%" borderVisible="true">
请注意,应用程序的宽度和高度均为 100%。
现在,当我减小浏览器的大小时,滚动条不会出现。在 s:NavigatorContent(始终在 ViewStack 内)的一种情况下,会出现滚动条。
我很困惑为什么它只出现在一种情况下。如果我将策略设置为on,则 s:Scroller 会出现,但即使我将浏览器设置得非常小,它也会被禁用。
另外,我似乎找不到一种方法将这些滚动条涂成黑色。
谢谢。
I created a project which includes an mx:ViewStack as it's first container.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:comp="mycomp.*"
xmlns:mx="library://ns.adobe.com/flex/mx"
height="100%" width="100%"
minHeight="600" minWidth="800">
<s:layout>
<s:VerticalLayout horizontalAlign="center" />
</s:layout><mx:ViewStack horizontalCenter="0"
verticalCenter="0"
id="contentVs"
height="100%"
width="100%">
<s:NavigatorContent name="biography"
label="Biography"
width="100%"
height="100%">
<comp:Biography />
</s:NavigatorContent>
<s:NavigatorContent name="collections"
label="Collections"
width="100%"
height="100%">
<comp:Collections/>
In each s:NavigatorContent inside the mxViewStack I have a custom s:SkinnableContainer component. In these components I added a s:Scroller as the first child container.
<?xml version="1.0" encoding="utf-8"?>
<s:SkinnableContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="100%" height="100%"
creationComplete="this_creationCompleteHandler(event)">
<s:Scroller id="scroller1"
width="100%"
height="100%">
<s:Group>
<s:BorderContainer width="100%" height="100%" borderVisible="true">
Note that the application has 100% for both width and height.
Now when I decrease the size of the browser the scroller does not appear. In one of the s:NavigatorContent(always inside the ViewStack) cases the scroller appears.
I am puzzled why it does appear in one case only. If I set the policy to on the s:Scroller appears but it is disabled even if I make my browser pretty small.
Plus I can't seem to find a way to color these scrollers to black.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我无法从您的代码示例中准确地看到,但是这一行:
使它看起来像滚动条组的内容设置了 height="100%" 。
仅当组的内容比其本身更宽或更高时,滚动条才会显示滚动条。
尝试将组的宽度和高度设置为 100%,并确保组的内容高于 Scroller。
例如。
I can't see exactly from your code sample, but this line:
makes it look like the content of the scroller's group has height="100%" set.
The scroller will only show a scrollbar if it's Group's content is either wider or taller than itself.
Try setting the group's width and height to 100% and ensuring that the content of the Group is taller than the Scroller.
eg.
我用 static(width="1200" height="800") 大小替换了 Viewstack 上的相对大小,这样就成功了。
关于更改 Scroller 组件的颜色,我必须创建自己的皮肤。
Spark.components.Scroller 的皮肤以及:
VScrollBarSkin
VScrollBarTrackSkin
VScrollBarThumbSkin
滚动条向上按钮外观
ScrollBarDownButtonSkin
与 HScrollBar 相同...
I replaced the relative size ont he Viewstack with a static(width="1200" height="800") size and that did the trick.
Concerning changing color on the Scroller component I had to create my own skins.
A skin for the spark.components.Scroller and also:
VScrollBarSkin
VScrollBarTrackSkin
VScrollBarThumbSkin
ScrollBarUpButtonSkin
ScrollBarDownButtonSkin
the same goes for the HScrollBar...