我有活动 A、B 和 C。它们都是 setContentView,其中 XML 使用可绘制的 aa 背景。我将我的背景可绘制图像放在 drawable-nodpi 文件夹中。
但是,每隔一段时间,我就会在活动 B 的崩溃报告中得到以下异常
java.lang.OutOfMemoryError: bitmap size exceeds VM budget
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:563)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:439)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
at android.content.res.Resources.loadDrawable(Resources.java:1981)
at android.content.res.TypedArray.getDrawable(TypedArray.java:653)
at android.view.View.<init>(View.java:1961)
at android.view.View.<init>(View.java:1909)
at android.view.ViewGroup.<init>(ViewGroup.java:286)
at android.widget.LinearLayout.<init>(LinearLayout.java:120)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
at android.view.LayoutInflater.createView(LayoutInflater.java:505)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:215)
at android.app.Activity.setContentView(Activity.java:1663)
at com.mypackage.myapp.ActivityB.onCreate
可绘制的背景具体为 67 KB,大小为 1122 x 1682 像素。
我该怎么办?我什至无法在我的手机上复制它