/**     *  added by yangguangfu Draw the view into a bitmap.     */   private  Bitmap getViewBitmap(View v) {      Bitmap bitmap=null;    if(v!=null){     v.clearFocus();            v.setPressed(false);            boolean willNotCache = v.willNotCacheDrawing();            v.setWillNotCacheDrawing(false);            // Reset the drawing cache background color to fully transparent            // for the duration of this operation            int color = v.getDrawingCacheBackgroundColor();            v.setDrawingCacheBackgroundColor(0);            float alpha = v.getAlpha();            v.setAlpha(1.0f);            if (color != 0) {                v.destroyDrawingCache();            }            v.buildDrawingCache();            Bitmap cacheBitmap = v.getDrawingCache();            if (cacheBitmap == null) {                Log.e(TAG, "failed getViewBitmap(" + v + ")", new RuntimeException());                return null;            }             bitmap = Bitmap.createBitmap(cacheBitmap);            // Restore the view            v.destroyDrawingCache();            v.setAlpha(alpha);            v.setWillNotCacheDrawing(willNotCache);            v.setDrawingCacheBackgroundColor(color);    }               return bitmap;    }

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. Python技术,我们这一年...
  2. python进阶训练营
  3. 小数据、高准确率的文本分类:利用迁移学习
  4. 我从过去八个月的AI公司面试中学到了什么
  5. 因为AI,Blued成为垂直社交产品里“不一样
  6. flowable 流程图片汉字的乱码问题
  7. 都 2021 年了,居然还有人在手写测试数据?
  8. 体系课-数据可视化入门到精通-打造前端差
  9. 我擦!发红包遇到了微信抖动!
  10. 用 Python + Appium 的方式自动化清理微