我正在PhoneGap
开发一个简单的Android应用,用户可以在其中计算出他们的GPA和CGPA。
我感觉到一些奇怪的事情发生了。每当用户倾斜屏幕并从纵向模式切换到横向模式时,应用程序将返回上一页,就像按下后退按钮一样。
这是我的清单文件的外观,
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.firstVersion"
android:versionCode="3"
android:versionName="1.2" >
<uses-sdk
android:minSdkVersion="4"
android:targetSdkVersion="17" />
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:xlargeScreens="true"
android:resizeable="true"
android:anyDensity="true"
/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:configChanges="orientation|keyboardHidden"
android:allowBackup="true"
android:icon="@drawable/app_icon"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.firstVersion.MainActivity"
android:label="@string/app_name" >
android:launchMode="singleTop"
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="org.apache.cordova.DroidGap"
android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden">
<intent-filter></intent-filter>
</activity>
<receiver android:name="com.phonegap.plugin.localnotification.AlarmReceiver" >
</receiver>
<receiver android:name="com.phonegap.plugin.localnotification.AlarmRestoreOnBoot" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver android:name="com.bicrement.plugins.localNotification.AlarmReceiver" >
</receiver>
<receiver android:name="com.bicrement.plugins.localNotification.AlarmRestoreOnBoot" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
</application>
</manifest>
答案 0 :(得分:1)
在应用程序代码中编写的每个活动代码下不添加 android:configChanges ,并将其跳转到MainActivity标记
试试这个: -
<activity
android:name="com.example.firstVersion.MainActivity"
android:configChanges="orientation|screenSize|keyboardHidden|keyboard|locale"
android:label="@string/app_name">