/**     *  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. Ubuntu下Android(安卓)Studio在真机测试
  2. 模拟器上“插入”SD卡
  3. Android(安卓)2.1学习笔记(二)
  4. Android中SharedPreference多进程数据共
  5. couldn't find import for class android
  6. 【Android學習專題】視覺介面篇:Android布
  7. Android(安卓)Binder分析五:Java service
  8. Android标题栏随滑动渐变效果的实现
  9. Android(安卓)8.1 中Systemui中的常见修
  10. android-apt和annotationProcessor的使用