如何在标题标签的右侧放置一个工具栏按钮?

时间:2014-05-21 17:08:12

标签: javascript html5 mobile dojo

我将dojox.mobile.Heading添加到dojox.mobile.ScrollableView。这很好用,我在标题上也有一个后退按钮。我正在尝试在标题标签的右侧添加一个工具栏按钮,但它显示在标签的左侧,在后退按钮之后:

    var heading2 = new dojox.mobile.Heading({
        id: "appListHeader",
        label: "?", // placeholder, replaced when device is selected.
        back: "Devices",
        moveTo: "deviceList"
    });

    var button = new dojox.mobile.ToolBarButton ({
        moveTo: "settingsView",
        icon: "../images/settings.png"
    });
    button.placeAt(heading2,"last");

enter image description here

1 个答案:

答案 0 :(得分:1)

尝试使用" dojo / dom-style"如下图所示,使用按钮的domNode。

require(["dojo/dom-style"], function(domStyle){
  domStyle.set(button.domNode, {float:"right"});
});

placeAt(last)将它放在小部件的末尾,我假设。

button.placeAt(heading2,"last");

希望它有所帮助。