我的Alloy应用程序中有一个SplitWindow控件,我似乎无法显示主窗口和详细信息窗口的Title或TitleControl。我在JIRA中发现Alloy还不支持SplitWindow Windows的TitleControl,但即使在JS中创建它们似乎也不起作用。我在下面提供了我的代码。这是一个如何渲染SplitWindow的截图。
的settings.xml
<Alloy>
<SplitWindow id="settings" navBarHidden="false">
<Window id="master_window" navBarHidden="false">
</Window>
<Window id="detail_window" navBarHidden="false">
</Window>
</SplitWindow>
</Alloy>
settings.js
function bind() {
$.master_window.setNavBarHidden(false);
$.master_window.setTitle('Title here');
};
bind();
答案 0 :(得分:0)
<Alloy>
<SplitWindow id="index" formFactor="tablet">
<Window>
<NavigationGroup id="masterView">
<Window id="master_window" navBarHidden="false" title="Master"></Window>
</NavigationGroup>
</Window>
<Window>
<NavigationGroup id="detailView">
<Window id="detail_window" navBarHidden="false" title="Detail">
<ListView id="list" defaultItemTemplate="template1"></ListView>
</Window>
</NavigationGroup>
</Window>
</SplitWindow>
</Alloy>
显示您需要的标题是NavigationGroup或TabGroup
这是一个类似的示例,但是使用TabGroup来显示标题而不是NavigationGroup
<Alloy>
<SplitWindow id="index" formFactor="tablet">
<!-- use TabGroup to get title to show -->
<TabGroup>
<Tab title="tab 1" >
<!-- hide the tabBar so it looks like a regular window -->
<Window id="master_window" tabBarHidden="true" title="Master"></Window>
</Tab>
</TabGroup>
<Window>
<!-- use NavigationGroup to get title to show -->
<NavigationGroup id="detailView">
<Window id="detail_window" navBarHidden="false" title="Detail">
<ListView id="list" defaultItemTemplate="template1"></ListView>
</Window>
</NavigationGroup>
</Window>
</SplitWindow>
</Alloy>