2013-02-04 34 views
0

我正在創建一個android遊戲,其中每個活動都設置爲在xml清單文件中的橫向中。在切換到風景之前,活動在肖像中閃爍起來

但是,有時在進行新的活動時,它會在修正風景之前以肖像閃爍一秒。

有沒有人有任何通用的原因,爲什麼這可能是?

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.appsolutely.sheepherder" 
android:versionCode="1" 
android:versionName="1.0" > 

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

<application 
    android:allowBackup="true" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 
    <activity 
     android:name="com.appsolutely.sheepherder.Main" 
     android:label="@string/app_name" 
     android:screenOrientation="landscape" > 
    </activity> 
    <activity 
     android:name="com.appsolutely.sheepherder.Game" 
     android:label="@string/title_activity_game" 
     android:screenOrientation="landscape" > 
     <meta-data 
      android:name="android.support.PARENT_ACTIVITY" 
      android:value="com.appsolutely.sheepherder.LevelSelect" /> 
    </activity> 
    <activity 
     android:name="com.appsolutely.sheepherder.LevelSelect" 
     android:label="@string/title_activity_level_select" 
     android:screenOrientation="landscape" > 
     <meta-data 
      android:name="android.support.PARENT_ACTIVITY" 
      android:value="com.appsolutely.sheepherder.Main" /> 
    </activity> 
    <activity 
     android:name="com.appsolutely.sheepherder.Splash" 
     android:label="@string/app_name" 
     android:screenOrientation="landscape" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
    <activity 
     android:name="com.appsolutely.sheepherder.Plague" 
     android:label="@string/title_activity_plague" 
     android:screenOrientation="landscape" > 
     <meta-data 
      android:name="android.support.PARENT_ACTIVITY" 
      android:value="com.appsolutely.sheepherder.Main" /> 
    </activity> 
</application> 

+0

你可以發佈你的清單,所以我們可以看看? –

+0

感謝您的回覆,我已將我的清單文件發佈在 –

回答

0

嘗試添加screenOrientation到:

它退出層面完成屏幕太早,它使用的ScheduledFuture

感謝 安迪

EDIT(清單)時發生您的清單:

<activity android:screenOrientation="sensorLandscape" ...> 

我建議使用sensorLandscape,這樣用戶可以選擇是將工具旋轉到右側還是左側。

+0

以上感謝您的回覆。我實際上已經在Manifest文件中有這個。我編輯了我的原始帖子以顯示Manifest文件 –

+0

您是否嘗試調用['setRequestedOrientation(...)'](http://developer.android.com/reference/android/app/Activity.html#setRequestedOrientation %28int%29)在你的['onCreate'](http://developer.android.com/reference/android/app/Activity.html#onCreate%28android.os.Bundle%29)回調? – rekire

+0

是的,我已經嘗試過......當單擊CustomDialog上的按鈕時,實際發生的問題更具體。這可能是原因嗎?對話是以肖像的方式,也許? –