如何使用Alloy重置Titanium主窗口的方向?

时间:2015-02-07 12:07:59

标签: titanium titanium-alloy

我的主窗口(index.xml)的方向属性设置如下:

orientationModes: [ Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT ],

现在我在主窗口中有一个按钮,点击它后打开另一个窗口(比如Gallery.xml)。

Gallery.xml的方向模式是:

orientationModes: [
    Ti.UI.LANDSCAPE_RIGHT,
    Ti.UI.LANDSCAPE_LEFT
]

每当我点击此按钮时,Gallery.xml都会以横向模式打开。关闭Gallery.xml窗口后,主窗口再次变为纵向模式。

但是这个系列的定位只能工作两到三次,之后主窗口只设置为横向模式&然后永远不会改变。

如果有人能告诉我应该如何处理这个功能,以保持主窗口处于纵向模式&仅在横向模式下的画廊窗口?

1 个答案:

答案 0 :(得分:0)

  

使主窗口保持纵向模式&仅在横向模式下的画廊窗口?

您可以使用窗口的orientation属性。

因此,在main.xmlmain.tss根窗口中添加此orientation属性。例如:

<Window id="main" orientation=Titanium.UI.PORTRAIT >
    <Button>Test</Button>
</Window>

同样在Gallery.xmlGallery.tss窗口中添加orientation属性以限制横向模式。例如:

<Window id="gallery" orientation=Titanium.UI.LANDSCAPE_LEFT >
    <Button>Test</Button>
</Window>
相关问题