tags:

views:

8851

answers:

3

How can I disable landscape mode for some of the views in my Android app?

+1  A: 

Are you essentially trying to disable the auto-rotate feature. Try setting your preferred orientation in your portrait views?

http://code.google.com/android/reference/android/R.styleable.html#AndroidManifestActivity_screenOrientation

adam
+22  A: 

Add android:screenOrientation="portrait" to the activity in the AndroidManifest.xml. For example:

        <activity android:name=".SomeActivity"
              android:label="@string/app_name"
              android:screenOrientation="portrait">
Yoni Samlan
A: 

I was not aware of the AndroidManifest.xml file switch until reading this post, so in my apps have have used this instead:

setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);     //  Fixed Portrait orientation

R.

Rich