我有一個應用程序,我正在使用Landscape和potrait模式。我在我的每個活動中都使用了android:configChanges =「orientation | keyboardHidden」。所以當我在設備2.3上運行它時,它完全正常工作,並且活動未重新啓動。但是,當我在Android 4.0及以上版本中打開相同的應用程序時,只要方向改變,活動就會重新啓動。 這是我的xml文件。活動當方向更改android時重新啓動?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.iconnect.collaborator"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<supports-screens android:largeScreens="true"
android:normalScreens="true" android:smallScreens="true"
android:anyDensity="true" />
<supports-screens android:smallScreens="true" />
<supports-screens android:normalScreens="true" />
<supports-screens android:largeScreens="true" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:icon="@drawable/cnlogomini"
android:label="CollaborateNow"
android:largeHeap="true"
android:allowBackup="true"
android:theme="@style/AppTheme" >
<activity android:name="jim.h.common.android.zxinglib.CaptureActivity"
android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity android:name=".Register"
android:configChanges="orientation|keyboardHidden" ></activity>
<activity android:name=".ppllogincopy"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".Password"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".Camerascan"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".TabGroup1Activity"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".newtab"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".SubmitData"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".peoplelist"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".GenerateQrcode"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".contact"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".peoplelistlogin"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".Startnew"
android:configChanges="orientation|keyboardHidden"
></activity>
<activity android:name=".projectdetails"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".Signup"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".RegisterScan"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".peoplelistscan"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".Profile"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".List"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".Logout"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".scanRegister"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".scanList"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name="scanCamera"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name="com.iconnect.collaborator.Camera"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".collaborations"
android:configChanges="orientation|keyboardHidden"></activity>
<activity
android:name="com.iconnect.collaborator.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
你想阻止方向改變或不? –
已回答多次。你應該保存你的狀態並恢復它。 – m0skit0
不,我希望potrait和風景,但活動重新啓動,因爲在4.0和更高的方向更改,但不會在2.3重新啓動。 – user2699728