Android OutOfMemoryError-图层列表图像背景

Android OutOfMemoryError-图层列表图像背景,android,out-of-memory,android-bitmap,layer-list,Android,Out Of Memory,Android Bitmap,Layer List,我的背景图像是PNG 375 × 667 请注意,我在活动的onCreate() 我纯粹是在利用一个主题 使用正常的活动布局,用户将看到一个空白的黑屏2-3秒,然后才能在第一次启动应用程序时看到闪屏图像==>不是我想要的 我需要在用户打开应用程序时立即显示启动屏幕图像 有些人将启动屏幕设置为透明,这意味着用户在2-3秒钟内第一次看不到任何事情==>对我来说是不可接受的 Manifest.xml <activity android:name=".views.activ

我的背景图像是PNG 375 × 667
请注意,我在活动的
onCreate()

我纯粹是在利用一个主题
使用正常的活动布局,用户将看到一个空白的黑屏2-3秒,然后才能在第一次启动应用程序时看到闪屏图像==>不是我想要的
我需要在用户打开应用程序时立即显示启动屏幕图像
有些人将启动屏幕设置为透明,这意味着用户在2-3秒钟内第一次看不到任何事情==>对我来说是不可接受的

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>
<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>

styles.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>
<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


这种情况仅在少数设备中发生:

  • 沃达丰智能超6
  • A1601(Oppo)
  • SM-A800I(三星)

尝试添加此android:largeHeap=“true”



为此,您应该为不同的设备或任何小图像使用不同的图像

尝试在应用程序标记中应用您的SplashTheme样式,或者您可以向appTheme添加与SplashTheme相同的背景。这将快速显示您的飞溅图像。确保实施后检查所有活动。因为它将在应用程序中用作背景。在所有具有透明背景的活动中,它将显示背景。我希望这可能会对您有所帮助。

请仔细阅读我的问题,以了解我为什么选择您的方法。我认为您的呼叫延迟为3秒,您能签入java代码吗?也许可以试试看这是否有帮助。