android 7.0以上系统把webview内容生成长图异常

Android开发 想把webview的内容生成长图保存本地,7.0以上系统只能截取第一屏的内容生成长图,超出第一屏的显示
空白,7.0以下的正常生成,生成代码如下,哪位大神能指点一二吗 ,谢谢了,代码:
public Bitmap viewShot(final View view) {
if (view == null)
return null;
view.setDrawingCacheEnabled(true);
view.buildDrawingCache();
int measureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
view.measure(measureSpec, measureSpec);
if (view.getMeasuredWidth() <= 0 || view.getMeasuredHeight() <= 0) {
return null;
}
Bitmap bm;
try {
bm = Bitmap.createBitmap(view.getMeasuredWidth(), view.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
} catch (OutOfMemoryError e) {
System.gc();
try {
bm = Bitmap.createBitmap(view.getMeasuredWidth(), view.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
} catch (OutOfMemoryError ee) {
return null;
}
}
Canvas bigCanvas = new Canvas(bm);
Paint paint = new Paint();
int iHeight = bm.getHeight();
bigCanvas.drawBitmap(bm, 0, iHeight, paint);
view.draw(bigCanvas);
return bm;
}

3个回答

sfegerghrhrh

说明是你的strus拦截器的配置出了问题

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐