【问题标题】:How to reset the orientation of main window in Titanium using Alloy?如何使用合金重置钛中主窗口的方向?
【发布时间】:2015-02-07 12:07:59
【问题描述】:

我的主窗口(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 窗口后,主窗口再次变为纵向模式。

但是这一系列的方向只工作了两三次,之后主窗口设置为仅横向模式,然后永远不会改变。

如果有人能告诉我应该如何处理这个功能,将主窗口保持在纵向模式而画廊窗口只保持在横向模式,那将是非常有帮助的?

【问题讨论】:

    标签: titanium titanium-alloy


    【解决方案1】:

    让主窗口保持纵向模式,画廊窗口只保持横向模式?

    您可以使用窗口的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>
    

    【讨论】:

    • 我之前尝试过同样的事情,但我认为这是 Ti SDK 的问题,因为我将 SDK 更新到 3.4.0 GA,然后清理项目并重建,然后它就可以工作了..
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多