hrsetyono
hrsetyono

Reputation: 4464

Layout doesn't rotate automatically

Hi I already made two XML layout file with same name, one in layout folder and the other in layout-land.

I already add the configChanges tag in Manifest, like this:

<activity
    android:name=".Main"
    android:label="@string/title_activity_main"
    android:configChanges="orientation|screenSize" >
    ...
</activity>

The layout won't change automatically after rotating my phone.

But when I started the app in Landscape orientation, it will use the layout-land xml and keep using it even after I rotated my phone into portrait. So, there is no error in the landscape code.

I'm using Android 4.1.2 for testing. Is this the problem?

Or do I need to add some code in the Activity class?

Thanks

[Update]

I tried this in freshly-made project. But the problem still the same

Upvotes: 0

Views: 3665

Answers (1)

Sam
Sam

Reputation: 86948

Remove android:configChanges="orientation".

Using this attribute means that you will handle the rotation yourself, but you want the OS to handle it for you.

Upvotes: 6

Related Questions