/** * 返回的 bitmap就是屏幕的内容 */private static Bitmap takeScreenShot(Activity activity) {View view = activity.getWindow().getDecorView();//Enables or disables the drawing cacheview.setDrawingCacheEnabled(true);//will draw the view in a bitmapview.buildDrawingCache();Bitmap bitmap = view.getDrawingCache();Rect frame = new Rect();activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);int statusBarHeight = frame.top;int width = activity.getWindowManager().getDefaultDisplay().getWidth();int height = activity.getWindowManager().getDefaultDisplay().getHeight();// 去掉标题栏Bitmap b = Bitmap.createBitmap(bitmap, 0, statusBarHeight, width,height - statusBarHeight);view.destroyDrawingCache();return b;}

更多相关文章

  1. 【Android】【基础】获取屏幕宽高
  2. Android手动切换屏幕方向
  3. Android获取屏幕尺寸
  4. android 保持屏幕长亮及解锁的方法
  5. Android 获取屏幕尺寸实例代码
  6. Android获取屏幕宽高的方法
  7. android > 读取http html 内容

随机推荐

  1. 2.4.10 可展开的列表组件
  2. android 蓝牙
  3. 代码中设置drawableright
  4. android 获取系统硬件信息
  5. Android(安卓)实现文件的下载
  6. 学习Android动画小结
  7. Android笔记:Socket客户端收发数据
  8. android 获取IP地址
  9. android developer
  10. android SDK更新方法总结