【发布时间】:2013-12-26 09:28:46
【问题描述】:
我目前正在使用 Titanium Appcelerator 开发 Android 应用程序。当我加载我的应用程序时,它工作正常,但是当我将设备方向从纵向更改为横向或反之时,重新加载了窗口。如何修复我的应用以在方向更改时设置不重新加载?
这是我的 tiapp.xml:
<android xmlns:android="http://schemas.android.com/apk/res/android">
<tool-api-level>17</tool-api-level>
<manifest android:installLocation="preferExternal"
android:versionCode="3" android:versionName="1.0.2">
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="17"/>
<application android:theme="@style/Theme.Action">
<activity android:configChanges="keyboardHidden|orientation" android:name="org.appcelerator.titanium.TiActivity"/>
</application>
</manifest>
</android>
在我的 app.js 中:
var tabGroup = Titanium.UI.createTabGroup();
var myWindow = Titanium.UI.createWindow({
title: "My Window",
url: "window/myWindow.js"
});
var myTab = Titanium.UI.createTab({
window: myWindow,
});
tabGroup.addTab(myTab);
tabGroup.open();
这是我的窗口(myWindow.js):
var currentWin = Ti.UI.currentWindow;
currentWin.addEventListener('open', function() {
alert('Hello World');
});
更改设备方向时已加载警报“Hello World”。
【问题讨论】:
标签: android titanium orientation appcelerator