位图大小超过32位 - 用于从缓存恢复状态视图

时间:2014-01-31 11:09:31

标签: android bitmap android-4.4-kitkat

对于KitKat,当系统恢复我的活动的先前状态时,应用程序会抛出异常 - bitmap size exceeds 32bits

我的活动包含ScrollView,其中WebView内容较大,背景上的瓷砖图片较多。

在代码

中查看恢复状态时

包android.view;

View.java

12848            final long projectedBitmapSize = width * height * (opaque && !use32BitCache ? 2 : 4);
12849            final long drawingCacheSize =
12850                    ViewConfiguration.get(mContext).getScaledMaximumDrawingCacheSize();
12851            if (width <= 0 || height <= 0 || projectedBitmapSize > drawingCacheSize) {
12852                if (width > 0 && height > 0) {
12853                    Log.w(VIEW_LOG_TAG, "View too large to fit into drawing cache, needs "
12854                            + projectedBitmapSize + " bytes, only "
12855                            + drawingCacheSize + " available");
12856                }
12857                destroyDrawingCache();
12858                mCachingFailed = true;
12859                return;
12860            }

我们在以下方面获得负面价值:

final long projectedBitmapSize = width * height * (opaque && !use32BitCache ? 2 : 4);

例如:

autoScale = true
attachInfo = {android.view.View$AttachInfo@830038767120}
height = 1174671
width = 768
drawingCacheBackgroundColor = 0
scalingRequired = false
opaque = false
use32BitCache = true
drawingCacheSize = 4096000
projectedBitmapSize = -686377984
clear = true
mUnscaledDrawingCache = null
mDrawingCache = null

如何解决?

0 个答案:

没有答案