ใครก็ได้โปรดช่วยอธิบายให้ฉันฟังว่าทำไม
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!!!
}
บันทึกเสมอว่าแคชการวาดเป็นโมฆะและตั้งค่าบิตแมปเป็น null?
ฉันต้องวาดมุมมองก่อนที่จะตั้งค่าแคชหรือไม่?
ขอบคุณ!
getDrawingCache()ใช้View#drawเพื่อCanvasเข้าใกล้