这里只记录一些链接,对于我的需求,只需要,

public static String createScreenShot(View v)     {        //测试截屏功能    SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd_HH-mm-ss",Locale.US);    String dirPath=Mapplication.SDPATH+Constants.QZ_PATH;    File dirFile=new File(dirPath);    if(!dirFile.exists())    {     dirFile.mkdir();    }     String  fname = Mapplication.SDPATH+Constants.QZ_PATH+sdf.format(new Date())+ ".png";          v.setDrawingCacheEnabled(true);     v.buildDrawingCache();      Bitmap bitmap = v.getDrawingCache();      if(bitmap  != null)    {          Bitmap bmpall=Bitmap.createBitmap(Mapplication.screen[0],CommonFun.dip2px(Mapplication.getContext(), 250),Config.ARGB_8888);                 Canvas canvas=new Canvas(bmpall);       Bitmap bmp1 = BitmapFactory.decodeResource(Mapplication.getContext().getResources(),R.drawable.pb_score_bg);       canvas.drawBitmap(bmp1,0,0,null);

canvas.drawBitmap(bitmap,0,0,null);

System.out.println("bitmap got!");             try{               FileOutputStream  out = new FileOutputStream(fname);               bmpall.compress(Bitmap.CompressFormat.PNG,100, out);               System.out.println("file" + fname + "output done.");               return fname;             }catch(Exception e) {               e.printStackTrace();               return "";             }           }else{             System.out.println("bitmap s NULL!");             return "";           }       }

用view getdrawingcache来截图(需求是只需要截特定的一部分),但是这样的图是没有背景的,所以 Canvas canvas=new Canvas(bmpall);       Bitmap bmp1 = BitmapFactory.decodeResource(Mapplication.getContext().getResources(),R.drawable.pb_score_bg);       canvas.drawBitmap(bmp1,0,0,null);

canvas.drawBitmap(bitmap,0,0,null); 是用canvas来绘制背景和图,,测试Ok

其他的截图文章:http://veikr.com/201202/android_screen_shot.html    http://blog.csdn.net/jokers_i/article/details/39549633

http://blog.csdn.net/xu_fu/article/details/39268771 http://blog.csdn.net/woshinia/article/details/11520403

关于android截图的一些方法的更多相关文章

  1. 【转】 Android Studio SVN 使用方法

    Android Studio SVN 使用方法 如何安装配置SVN 请直接参考<SVN在Android Studio中的配置> http://www.cnblogs.com/songmen ...

  2. Android截图命令screencap与视频录制命令screenrecord

    Android截图命令screencap 查看帮助命令 bixiaopeng@bixiaopeng ~$ adb shell screencap -v screencap: invalid optio ...

  3. 【Android】一种提高Android应用进程存活率新方法

    [Android]一种提高Android应用进程存活率新方法 SkySeraph Jun. 19st 2016 Email:skyseraph00@163.com 更多精彩请直接访问SkySeraph ...

  4. Android经典完美退出方法

    Android经典完美退出方法,使用单例模式创建一个Activity管理对象,该对象中有一个Activity容器(具体实现自己处理,使用LinkedList等)专门负责存储新开启的每一个Activit ...

  5. Android获取系统时间方法的总结

    Android获取系统时间方法的方法有很多种,常用的有Calendar.Date.currentTimeMills等方法. (1)Calendar Calendar获取系统时间首先要用Calendar ...

  6. 删除Android自带软件方法及adb remount 失败解决方案

    删除Android自带软件方法 1.在电脑上打开cmd,然后输入命令 adb remount adb shell su 2.接着就是Linux命令行模式了,输入 cd system/app 3然后输入 ...

  7. PhoneGap 在 Android 上的插件开发方法介绍

    移动应用开发已经成为软件开发的一个重要方向,但是移动开发面临的一个重要问题就是跨平台的问题.PhoneGap 作为一个多平台的软件开发框架,提供了一次编写多个平台的运行.目前已经支持多达 6 个移动平 ...

  8. Android之完美退出方法

    为什么要写这篇文章? 网上有很多种退出方法,可实际上很多方法都不通用(在某个版本下可用,到了另一个版本就不行),或者方法的实际效果根本就和其描述不符(也不知道那些发帖的人测没测试过). 但我们的需求又 ...

  9. (转)Android之常用功能方法大集合

    这些,都是Andorid中比较常用的方法和功能,在网上搜集整理一下记录之,以备不时之需.由于经过多次转载,源文作者不确凿,在此申明,敬请见谅.不得不赞,非常实用. 1.判断sd卡是否存在 boolea ...

随机推荐

  1. jsp页面动态显示时间

    <SCRIPT language="JavaScript">  function disptime(){ var time = new Date(); var hour ...

  2. Oracle字符集修改

    1.使用管理员账号登录到oracle C:\Users\Administrator>sqlplus / as sysdba 2.查看字符集 SQL>select userenv('lang ...

  3. cookie的详细解释

    突然看到网页上中英文切换的效果,不明白怎么弄得查了查 查到了cookie 并且附有详细解释 就copy留作 以后温习 http://blog.csdn.net/xidor/article/detail ...

  4. (转)如何进行Monkey Test

    如何进行Monkey Test   目录 一 简介 二 测试准备 三 基本命令格式 四 测试Log获取 五 Monkey命令参数介绍 六 保存monkey log以及手机log到sdcard(新增) ...

  5. sql 查询执行的详细时间profile

    1.查看profile的设置 SHOW VARIABLES LIKE '%profil%' 结果如下:profiling OFF 为关闭状态 2.开启profile 结果: 3.执行需要执行的sql ...

  6. LEETCODE —— Populating Next Right Pointers in Each Node

    Populating Next Right Pointers in Each Node Given a binary tree struct TreeLinkNode { TreeLinkNode * ...

  7. LEETCODE —— Binary Tree的3 题 —— 3种非Recursive遍历

    Binary Tree Preorder Traversal Given a binary tree, return the preorder traversal of its nodes' valu ...

  8. OpenGL渲染管线

    OpenGL渲染管线具有一系列顺序处理阶段.两个图形信息数据,顶点数据与像素数据,在管线中被处理.组合,最终写入帧缓存.注意,OpenGL可以将处理过的数据送回到你的程序中.(参考灰色区域) Open ...

  9. oracle中TO_CHAR与TO_DATE

    TO_CHAR 是把日期或数字转换为字符串TO_DATE 是把字符串转换为数据库中得日期类型转换函数 TO_DATE格式(以时间:2016-07-25   11:45:25为例) Year: yy t ...

  10. geohash基本原理

    geohash基本原理是将地球理解为一个二维平面,将平面递归分解成更小的子块,每个子块在一定经纬度范围内拥有相同的编码,这种方式简单粗暴,可以满足对小规模的数据进行经纬度的检索 目录: 经纬度常识 认 ...