是否可以仅从视图的可见部分创建位图?我使用的是列表视图,但它的元素比屏幕高,所以当我从子视图获取 DrawingCache 时,我得到的位图比屏幕高。
现在我正在这样做:
overlayView.setDrawingCacheEnabled(true);
overlayView.buildDrawingCache();
mViewBitmap = Bitmap.createBitmap(overlayView.getDrawingCache());
overlayView.destroyDrawingCache();
overlayView.setDrawingCacheEnabled(false);