réglage screenOrientation dans AndroidManifest.xml ne fonctionne pas

J'ai un simple hello world Android, le projet de tests. Dans mon AndroidManifest.xml j'ai déjà mis

android:screenOrientation="portrait" 
android:configChanges="keyboardHidden|keyboard|orientation">

mais quand je debug mon code, la variable jardin flottant est Vrai quand il le faut censé être Faux

boolean isLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;

Je sais que je peux aussi définir l'orientation des activités par le code, mais j'ai besoin de la mettre en xml pour certaines raisons. Comment puis-je le faire?

Edit: ma AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidgames.mreater"
android:versionCode="1"
android:versionName="1.0" 
android:installLocation="preferExternal">

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />

<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<application
    android:icon="@drawable/ic_launcher"
    android:allowBackup="true"
    android:label="Mr. Eater" >
    <activity
        android:name="com.androidgames.mreater.MrEaterGame"
        android:label="Mr. Eater" 
        android:screenOrientation="portrait"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

mon onCreate de l'activité de la méthode:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    boolean isLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);

    int frameBufferWidth = isLandscape ? 480 : 320;
    int frameBufferHeight = isLandscape ? 320 : 480;
   Bitmap frameBuffer = Bitmap.createBitmap(frameBufferWidth,
            frameBufferHeight, Config.RGB_565);

    float scaleX = (float) frameBufferWidth
            /getWindowManager().getDefaultDisplay().getWidth();
    float scaleY = (float) frameBufferHeight
            /getWindowManager().getDefaultDisplay().getHeight();

    renderView = new AndroidFastRenderView(this, frameBuffer);
    graphics = new AndroidGraphics(getAssets(), frameBuffer);
    fileIO = new AndroidFileIO(getAssets());
    audio = new AndroidAudio(this);
    input = new AndroidInput(this, renderView, scaleX, scaleY);
    screen = this.getStartScreen();
   setContentView(renderView);

    PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
    wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "GLGame");
}

Maintenant, il devient de plus en plus étrange, le jardin flottant variable est Vrai, mais parfois, c'est Faux. C'est en quelque sorte comme un bug.

Ne l'orientation de l'écran en fait, changer ou tout simplement que la variable est de retour vrai?
Vous êtes sur l'activité de la balise de droit? Ne pas le mettre dans la balise application? developer.android.com/guide/topics/manifest/...
l'Activité de l'écran est en mode paysage, pas dans le portrait que je veux.
oui. Je l'ai mis dans l'activité de la balise.
bizarre. J'ai littéralement tout essayé et ne peux pas reproduire le problème. Ce problème sur tous les appareils/les émulateurs?

OriginalL'auteur Cuồn Yết | 2013-06-26