Reputation: 2684
I have an app where I have a layout folder and a layout-port folder, each having separate main.xml layouts.
If I start the app with the phone tilted to portrair, the portrait main.xml loads fine. And vice versa. But when you flip the phone, it keeps the same main.xml.
So for example, if I start debug the app loads and the phone is started in portrait, it will load the portrait main.xml, then I tilt the phone to landscape and it changes orientation, but it is the same main.xml layout. It is not fetching the landscape layout.
And vice versa...if I start debug with the phone in landscape, it loads the landscape main.xml...but then I tilt the phone and it is still using the landscape main.xml even though it corrects the position of the layout.
android:screenOrientation="unspecified"
android:launchMode="singleTask"
android:configChanges="orientation|keyboardHidden"
Upvotes: 0
Views: 297
Reputation: 493
If you're not overriding the method onConfigurationChanged
in your activity, you can remove the line android:configChanges="..."
in your AndroidManifest. Without this line, a change in orientation will cause the activity to be restarted and the correct layout to be applied.
Upvotes: 1