ViewNavigator显示应用程序的顶部

时间:2013-03-29 17:03:10

标签: actionscript-3 flex flex4.5 skinning flex-mobile

我在s:TabbedViewNavigatorApplication中有一个s:ViewNavigator组件。目前它显示在底部。如何在操作栏下方的应用程序顶部显示它?虽然我喜欢flex sdk中所有相关的皮肤,但我发现没有任何与位置有关的内容。

P.S。这是Flash Builder 4.6中的移动应用程序

在s:TabbedViewNavigatorApplication组件中:

var nav:ViewNavigator = new ViewNavigator();
nav.label = "Newest";
nav.firstView = HomeView;
nav.firstViewData = "recent";
nav.percentWidth = 100;
nav.percentHeight = 100;

this.addElement(nav);
nav.titleContent = [];

s中的变化:TabbedViewNavigatorApplication Skin: (如果陈述,则交换) (将tabBar的y位置改为60)

if (contentGroup.includeInLayout)
        {
            var contentGroupHeight:Number = (_isOverlay) ? unscaledHeight : Math.max(unscaledHeight - tabBarHeight, 0);
            contentGroup.setLayoutBoundsSize(unscaledWidth, contentGroupHeight);
            contentGroup.setLayoutBoundsPosition(0, 0);
        }
        if (tabBar.includeInLayout)
        {
            tabBarHeight = Math.min(tabBar.getPreferredBoundsHeight(), unscaledHeight);
            tabBar.setLayoutBoundsSize(unscaledWidth, tabBarHeight);
            tabBar.setLayoutBoundsPosition(0, 60); //unscaledHeight - tabBarHeight
            tabBarHeight = tabBar.getLayoutBoundsHeight(); 

            // backgroundAlpha is not a declared style on ButtonBar
            // TabbedViewNavigatorButtonBarSkin implements for overlay support
            var backgroundAlpha:Number = (_isOverlay) ? 0.75 : 1;
            tabBar.setStyle("backgroundAlpha", backgroundAlpha);
        }

ViewNavigator Skin中的更改:

(从contentGroupHeight带走( - )contentGroupPosition)

(将contentGroupPosition乘以2,以便app中的其他元素不会低于buttonBar。操作栏和buttonBar必须大小相同才能正常工作且无法访问按钮栏的高度据我所知,它本身来自vieNavigator皮肤)

if (contentGroup.includeInLayout)
        {
            // If the hostComponent is in overlay mode, the contentGroup extends
            // the entire bounds of the navigator and the alpha for the action 
            // bar changes
            // If this changes, also update validateEstimatedSizesOfChild
            var contentGroupHeight:Number = (_isOverlay) ? unscaledHeight : Math.max(unscaledHeight - actionBarHeight, 0);
            var contentGroupPosition:Number = (_isOverlay) ? 0 : actionBarHeight;

            contentGroup.setLayoutBoundsSize(unscaledWidth, contentGroupHeight-contentGroupPosition);
            contentGroup.setLayoutBoundsPosition(0, contentGroupPosition*2);
        }

0 个答案:

没有答案