When some configurations changed, such as orientation, the app will be restarted, the the view will be recreated, onCreate
will be called.
When the view is re-created, the ActionBar will turn to the origin state.
But if you add android:configChanges="keyboardHidden|orientation|screenSize"
to the Manifest.xml
, the onConfigurationChanged
will be called instead of onCreate
, the view will not be re-created.
update1
You should keep android:configChanges="keyboardHidden|orientation|screenSize", then change the layouts after the change of screen sizes and orientation occurs, in the method: onConfigurationChanged
.
Here are some examples: Handling Runtime Changes