dojo tabbar programatically created but not fixed

2019-08-28 00:19发布

问题:

i created a dojo tabbar programmatically and set the fixed:"bottom" attribute but the tabbar is created below the existing document and not fixed at the bottom of the window. After i have done a performeTransition to another view its fixed at bottom correctly.

i did it like this:

        function createTabbar() {   
        var tabBar = new dojox.mobile.TabBar({id:"tabContainer", barType : "tabBar", fixed: "bottom"}).placeAt(dijit.byId("mobileView")); 
        var tabBarButtonNodes = new dojox.mobile.TabBarButton({label:"Knoten", id:"tabBarButtonNodes", moveTo:"divNodes0", icon1 : "img/nodes_60.png", icon2 : "img/nodes_60.png"}).placeAt(tabBar.domNode); 
        var tabBarButtonInfo = new dojox.mobile.TabBarButton({label:"Info", id:"tabBarButtonInfo", moveTo:"divInfo", icon1 : "img/info_60.png", icon2 : "img/info_60.png"}).placeAt(tabBar.domNode); 
        var tabBarButtonLogin = new dojox.mobile.TabBarButton({label:"Login", id:"tabBarButtonLogin", moveTo:"divLogin", icon1 : "img/login_60.png", icon2 : "img/login_60.png"}).placeAt(tabBar.domNode); 
        var teest = dijit.byId("divInfo");
        tabBar.resize();
        }

do i have to resize anything else?

回答1:

As documented, the "fixed" flag matters for dojox/mobile/ScrollableView only. There are two cases: a header/footer at the level of the entire application, and locally at the level of a given ScrollableView. You can find details here:

  • local view header/footer: https://dojotoolkit.org/reference-guide/1.9/dojox/mobile/ScrollableView.html#view-header-footer-bar-example
  • global application header/footer: https://dojotoolkit.org/reference-guide/1.9/dojox/mobile/ScrollableView.html#application-header-footer-bar-example

For the local case, you can add the fixed bar using the method ScrollableView.addFixedBar. For an example, see dojox/mobile/tests/test_dynamic-ScrollableView-vh-vf.html.

Hope this helps, Adrian