能否有人向我解释一下为什么
public void addView(View child) {
child.setDrawingCacheEnabled(true);
child.setWillNotCacheDrawing(false);
child.setWillNotDraw(false);
child.buildDrawingCache();
if(child.getDrawingCache() == null) { //TODO Make this work!
Log.w("View", "View child's drawing cache is null");
}
setImageBitmap(child.getDrawingCache()); //TODO MAKE THIS WORK!!!
}
始终记录了绘图缓存为空,并将位图设置为空?
我是否必须在设置缓存之前实际绘制视图?
谢谢!
getDrawingCache()
,而是使用View#draw
到Canvas
的方法来截取整个视图的屏幕截图。 - Yuraj