当前位置:操作系统 > 安卓/Android >>

android 截屏

1.给一个任意的视图对象就可以!实现截图!
public Bitmap getView(View view)
{
// 设置使用缓存绘图
view.setDrawingCacheEnabled(true);
// 建立缓存
view.buildDrawingCache();
Bitmap tmp = view.getDrawingCache();
view.setDrawingCacheEnable(false);
return tmp;
}


2.截屏
public Bitmap getView(Activity activity)
{
View view = activity.getWindow().getDecorView();
// 设置使用缓存绘图
view.setDrawingCacheEnabled(true);
// 建立缓存
view.buildDrawingCache();
Bitmap tmp = view.getDrawingCache();
view.setDrawingCacheEnable(false);
return tmp;
}


 

补充:移动开发 , Android ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,