该方法主要利用SDK提供的view.getDrawingCache()方法,主要步骤如下:
- 设置view.setDrawingCacheEnabled(true)
- 调用view.buildDrawingCache(true)
- 生产bitmap:Bitmap b = Bitmap.createBitmap(v.getDrawingCache())
- 最后再设置回去v.setDrawingCacheEnabled(false)
-
public Bitmap takeScreenShotOfView(View v) { v.setDrawingCacheEnabled(true); v.buildDrawingCache(true); Bitmap b = Bitmap.createBitmap(v.getDrawingCache()); v.setDrawingCacheEnabled(false); // clear drawing cache return b; }
9606

被折叠的 条评论
为什么被折叠?



