[英]Titanium android reloading when orientation was changed
I'm currently developing Android App using Titanium Appcelerator. 我目前正在使用Titanium Appcelerator开发Android App。 When I load my application it works fine, but when I changed my device orientation from portrait to landscape or vice verse the window reloaded. 当我加载应用程序时,它可以正常工作,但是当我将设备方向从纵向更改为横向或反之时,则重新加载了窗口。 How can I fixed my app to set no reload when orientation was changed? 方向更改后,如何修复我的应用以使其不重新加载?
Here's my tiapp.xml: 这是我的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>
and in my app.js: 在我的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();
and here's my window(myWindow.js): 这是我的窗口(myWindow.js):
var currentWin = Ti.UI.currentWindow;
currentWin.addEventListener('open', function() {
alert('Hello World');
});
The alert "Hello World" has been loaded upon changing of device orientation. 更改设备方向后已加载警报“ Hello World”。
我发现答案只是改变了tiapp.xml的android活动
<activity android:configChanges="screenSize|orientation" android:name="org.appcelerator.titanium.TiActivity"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.