2016-12-15 62 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。这会很快显示你的飞溅图像。确保一旦执行检查所有活动。因为它将在您的应用程序中用作背景。在所有具有透明背景的活动中,它将显示为背景。我希望这可以帮助你。