android视图截屏功能
来源:互联网 发布:linux 安装bcompare 编辑:程序博客网 时间:2024/05/18 16:13
public
Bitmap getViewBitmap(View v) {
v.clearFocus();
// 清除视图焦点
v.setPressed(
false
);
// 将视图设为不可点击
boolean
willNotCache = v.willNotCacheDrawing();
// 返回视图是否可以保存他的画图缓存
v.setWillNotCacheDrawing(
false
);
//将视图在此操作时置为透明
int
color = v.getDrawingCacheBackgroundColor();
// 获得绘制缓存位图的背景颜色
v.setDrawingCacheBackgroundColor(
0
);
// 设置绘图背景颜色
if
(color !=
0
) {
// 如果获得的背景不是黑色的则释放以前的绘图缓存
v.destroyDrawingCache();
// 释放绘图资源所使用的缓存
}
v.buildDrawingCache();
// 重新创建绘图缓存,此时的背景色是黑色
Bitmap cacheBitmap = v.getDrawingCache();
// 将绘图缓存得到的,注意这里得到的只是一个图像的引用
if
(cacheBitmap ==
null
) {
return
null
;
}
Bitmap bitmap = Bitmap.createBitmap(cacheBitmap);
// 将位图实例化
//恢复视图
v.destroyDrawingCache();
// 释放位图内存
v.setWillNotCacheDrawing(willNotCache);
// 返回以前缓存设置
v.setDrawingCacheBackgroundColor(color);
// 返回以前的缓存颜色设置
return
bitmap;
}
- android视图截屏功能
- android视图截屏功能,在eoe无意看到
- android 视图截屏
- Android视图功能总结(部分)
- Android截屏功能
- [Android]笔记16:网格视图(GridView)的功能与用法
- android截屏功能实现
- android截屏功能实现
- android截屏功能实现
- 【Android】实现截屏功能
- android实现截屏功能
- Android 禁止截屏功能
- “视图的功能” 小议
- oracle视图及其功能
- oracle视图及其功能
- Hibernate的视图功能
- Android系统截屏功能提取
- Android系统截屏功能提取
- ZipBeginFileEvent.class
- C++中构造函数和析构函数避免调用虚函数的问题
- Oracle Fusion Overview
- C++内存池的实现实例
- iOS 应用程序目录结构
- android视图截屏功能
- struts2国际化--更改浏览器默认语言环境
- 用户体验是网站建设的核心
- mysql之innodb存储引擎特性汇总
- MySQL数据库备份和还原的常用命令小结【备忘】
- Android研究-Android的init启动到launcher启动-主要分析zygote服务
- 自己写的绑Hosts脚本
- COM入门 一
- 单例