设置AndroidManifest.xml中Activity的android:configChanges=”keyboardHidden|orientation|screenSize”
Android4.0需设置screenSize才有效果.
2.2,2.3这些只需设置keyboardHidden|orientation
4.0 --> keyboardHidden|orientation|screenSize
- <activity
- android:name=".MainActivity"
- android:configChanges="keyboardHidden|orientation|screenSize"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>