public static Bitmap normalShot(Activity activity) {
View decorView = activity.getWindow().getDecorView();
decorView.setDrawingCacheEnabled(true);
decorView.buildDrawingCache();
Bitmap bitmap = Bitmap.createBitmap(decorView.getDrawingCache(), 0, 0,
decorView.getMeasuredWidth(), decorView.getMeasuredHeight());
decorView.setDrawingCacheEnabled(false);
decorView.destroyDrawingCache();
return bitmap;
}
首先利用Window的getDecorView()方法获取到屏幕上包含状态栏部分和用户应用程序里的内容。[ Retrieve the top-level window decor view (containing the standard window frame/decorations and the client's content inside of that). ]
然后使用decorView.getDrawingCache()方法返回被缓存的bitmap。[ Returns the bitmap in whic