ArcGIS for Android 中MapView截图实现方法
2014-05-09 11:33
495 查看
/**
* 把一个View的对象转换成bitmap
*/
private Bitmap getViewBitmap(MapView v) {
v.clearFocus();
v.setPressed(false);
//能画缓存就返回false
boolean willNotCache = v.willNotCacheDrawing();
v.setWillNotCacheDrawing(false);
int color = v.getDrawingCacheBackgroundColor();
v.setDrawingCacheBackgroundColor(0);
if (color != 0) {
v.destroyDrawingCache();
}
v.buildDrawingCache();
Bitmap cacheBitmap = null;
while(cacheBitmap == null){
cacheBitmap = v.getDrawingMapCache(0, 0, v.getWidth(), v.getHeight());
}
Bitmap bitmap = Bitmap.createBitmap(cacheBitmap);
// Restore the view
v.destroyDrawingCache();
v.setWillNotCacheDrawing(willNotCache);
v.setDrawingCacheBackgroundColor(color);
return bitmap;
}
* 把一个View的对象转换成bitmap
*/
private Bitmap getViewBitmap(MapView v) {
v.clearFocus();
v.setPressed(false);
//能画缓存就返回false
boolean willNotCache = v.willNotCacheDrawing();
v.setWillNotCacheDrawing(false);
int color = v.getDrawingCacheBackgroundColor();
v.setDrawingCacheBackgroundColor(0);
if (color != 0) {
v.destroyDrawingCache();
}
v.buildDrawingCache();
Bitmap cacheBitmap = null;
while(cacheBitmap == null){
cacheBitmap = v.getDrawingMapCache(0, 0, v.getWidth(), v.getHeight());
}
Bitmap bitmap = Bitmap.createBitmap(cacheBitmap);
// Restore the view
v.destroyDrawingCache();
v.setWillNotCacheDrawing(willNotCache);
v.setDrawingCacheBackgroundColor(color);
return bitmap;
}
相关文章推荐
- ArcGIS for Android 中MapView截图实现方法
- ArcGIS For Android MapView 截图
- ArcGIS for Android 地图控件 mapview 的常见操作
- arcgis for android MapView点击事件查询
- ArcGIS for Android开发之MapView控件篇
- Android 自定义View修炼-Android实现圆形、圆角和椭圆自定义图片View(使用BitmapShader图形渲染方法)
- ArcGIS for Android开发之MapView控件篇
- Arcgis for android Error inflating class com.esri.android.map.MapView
- 【Arcgis for android】Error inflating class com.esri.android.map.MapView【已解决】
- 【Arcgis for android】Error inflating class com.esri.android.map.MapView【已解决】
- ArcGIS for Android 1.1 MapView 的Activity退出时整个程序崩溃问题
- Android中通过view方式获取当前Activity的屏幕截图实现方法
- ( arcgis for android )用离线地图*.tpk(当.tpk不能用时)制作可用的离线地图的可用方法
- android---TextView中电话号码、网址自动链接的实现方法
- Android编程实现WebView添加进度条的方法
- 在android mapview控件里画简单导航路线的方法
- Android TextView实现垂直滚动效果的方法
- 《ArcGIS Runtime for Android 100.2.1学习笔记》三:使用LocationDisplay实现定位
- ibatis的queryForMap方法的使用与实现
- Android使用CircleImageView实现圆形头像的方法