2016-12-15 98 views
0

我的背景圖片是一個PNG 375×667
請注意,我在未使用setContentView()我的活動的onCreate()
我純粹是做一個主題
的用途使用正常活動的佈局,用戶將看到一個空白的黑屏2-3秒纔可以看到啓動畫面,他們啓動應用程序==>第一時間我想
我需要的閃屏圖像顯示立即在用戶打開應用程序時
有些人使初始屏幕透明,這意味着用戶將看到什麼也沒有發生2-3秒首次==>不可接受的OutOfMemoryError - 層列表圖像背景

的Manifest.xml

<activity 
      android:name=".views.activities.SplashActivity" 
      android:configChanges="orientation|keyboardHidden|screenSize" 
      android:launchMode="singleInstance" 
      android:screenOrientation="portrait" 
      android:theme="@style/SplashTheme" 
      android:windowSoftInputMode="stateAlwaysHidden|adjustResize"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN"/> 

       <category android:name="android.intent.category.LAUNCHER"/> 
      </intent-filter> 
     </activity> 

styles.xml

<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar"> 
     <item name="android:windowNoTitle">true</item> 
     <item name="android:windowActionBar">false</item> 
     <item name="android:windowFullscreen">true</item> 
     <item name="android:windowContentOverlay">@null</item> 
     <item name="android:windowIsTranslucent">false</item> 
     <item name="android:background">@drawable/bg_splash</item> 
    </style> 

bg_splash.xml

<item 
    android:drawable="@android:color/black"/> 

<item 
    android:drawable="@drawable/splash_full_tiny" 
    android:gravity="center"> 
</item> 

這只是發生了幾個設備:

  • 沃達豐智能超6
  • A1601(辰)
  • SM-A800I(三星)
+0

我覺得你在呼喚3秒的延遲,你可以在你的java代碼檢查? – kgsharathkumar

+0

也許嘗試 看看是否有幫助。 – rookiedev

回答

0

嘗試添加此android:largeHeap =「true」

<application 
     android:allowBackup="true" 
     android:icon="@drawable/icon" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" 
     android:largeHeap="true" 
     ></application> 
+0

它已經存在@LOW – ericn

-1

爲此,您應該爲不同的設備或任何小圖像使用不同的圖像。

+0

請仔細閱讀我的問題,以瞭解爲什麼我沒有去你的方法 – ericn

0

嘗試運用你的SplashTheme風格應用程序標記也可以添加背景appTheme一樣splashtheme。這會很快顯示你的飛濺圖像。確保一旦執行檢查所有活動。因爲它將在您的應用程序中用作背景。在所有具有透明背景的活動中,它將顯示爲背景。我希望這可以幫助你。