Question

I'm using eclipse and I'm trying to figure out how to only allow a Portrait state be used during game play. I can't seem to find any options in eclipse to block the Landscape state.

I'd appreciate any assistance. I know it's probably a simple matter, but I can't seem to find it and I've not tried to do this before.

Thanks in advance.

Était-ce utile?

La solution

In your AndroidManifest file you can achieve this. You will add the android:screenOrientation tag in your application declaration. Something like this

<application
    android:icon="@drawable/logo"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" 
    android:screenOrientation="portrait" > //HERE
    <activity
        android:name="com.test.SomeActivity"
        android:label="@string/app_name" >

You can change that to landscape as well. This attribute can also be applied to individual activities instead of the whole application if you need that.

Autres conseils

In the activity tags of your manifest file, add this:

android:screenOrientation="portrait"
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top