对于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
如何解决?