0

I have three different views for just one activity. These three views are stored in three different xml files.

I know it's possible to force activities orientation with this part of code :

    <activity
        android:screenOrientation="portrait"
    </activity>

But I'd like to have portrait orientation on the first view, and landscape orientation on the two others. How can I achieve this?

Neil Townsend
  • 6,024
  • 5
  • 35
  • 52
theMouk
  • 595
  • 1
  • 7
  • 21

1 Answers1

3

You could take a look at setRequestedOrientation(int). Just call it after you set your view.

http://developer.android.com/reference/android/app/Activity.html#setRequestedOrientation(int)

You might want to look at adding android:configChanges="orientation", which let's Android know you are taking care of the orientation changes yourself.

codebaum
  • 103
  • 6
  • Thanks it's work, but when I set a new orientation my onCreate is recall ... so i have ti find another solution :) – theMouk Apr 04 '13 at 15:49