In my application manifest I've add android:configChanges to prevent activity reload/restart on rotate
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden|screenSize" >
it works, but supportActionBar ( I'm using AppCompat ) preserves his height with small font size.
ActionBar should be bigger in portrait and smaller in landscape, but it keeps the initial value:
Removing android:configChanges="orientation|keyboardHidden|screenSize" is the only solution I've found, but the app restart on rotate, and I need to preserve application content
Starting in portrait
Starting in landscape
Starting in landscape and rotating screen to portrait (small action bar and small font height)
By setting android:configChanges="orientation|keyboardHidden|screenSize"
You declare that you will handle these config changes by yourself. In normal cases, you should not set that, and let Android recreate your Activity.
Edit:
If you want to keep the line android:configChanges
, you have to override onConfigChanged()
and change everything needed by yourself, e.g. the size of the ActionBar/ToolBar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With