地图视图到图像转换
我需要将地图视图转换为位图图像。我使用的代码如下:
MapView mapview = new MapView(this, "map_id_String");
mapview.setBuiltInZoomControls(true);
MapController mc = mapview.getController();
GeoPoint p = new GeoPoint((int) (36 * 1E6),(int) (36 * 1E6));
mc.animateTo(p);
mc.setZoom(20);
Bitmap viewCapture = null;
mapview.setDrawingCacheEnabled(true);
mapview.layout(0,0,400,400);
mapview.buildDrawingCache();
viewCapture = Bitmap.createBitmap(mapview.getDrawingCache());
mapview.setDrawingCacheEnabled(false);
return viewCapture;
但是此代码返回开始时的视图图像,该地图尚未完全解析。我需要等到mapview完全解决。
I need to convert mapview to bitmap image. I used the code as below:
MapView mapview = new MapView(this, "map_id_String");
mapview.setBuiltInZoomControls(true);
MapController mc = mapview.getController();
GeoPoint p = new GeoPoint((int) (36 * 1E6),(int) (36 * 1E6));
mc.animateTo(p);
mc.setZoom(20);
Bitmap viewCapture = null;
mapview.setDrawingCacheEnabled(true);
mapview.layout(0,0,400,400);
mapview.buildDrawingCache();
viewCapture = Bitmap.createBitmap(mapview.getDrawingCache());
mapview.setDrawingCacheEnabled(false);
return viewCapture;
But this code returns the image of view at the beginning, the map which has not been fully resolved. I need to wait it until mapview is fully resolved.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论