首页 / 浏览问题 / 移动GIS / 问题详情
MapView在安卓上,使用代码截屏,图片透明
3EXP 2019年11月05日
使用iMobile for Android加载iserver部署的在线地图服务,然后在app中使用代码截屏,得到图片是透明的,没有地图。

1个回答

您好,请问一下您使用的截屏代码是什么呢?能否说一下您那边的具体需求
9,127EXP 2019年11月06日
View dView = m_mapView;
dView.setDrawingCacheEnabled(true);
dView.buildDrawingCache();
Bitmap bitmap = Bitmap.createBitmap(dView.getDrawingCache());

我需要截图地图的定位信息,上传服务器。
您好,针对您的需求您可以直接使用我们产品提供的方法获取当前地图显示的内容,接口:mapcontrol.outputMap
outputMap方法的参数是bitmap,我只要创建一个空的bitmap就可以吧?
对。绘制成功返回为ture,地图内容就绘制在位图上了
Bitmap bitmap = Bitmap.createBitmap(mapLayout.getWidth(), mapLayout.getHeight(), Bitmap.Config.ARGB_8888);
boolean result = m_mapcontrol.outputMap(bitmap);
if (result) {
    try {
        File file=new File(GnbApplication.getApplication().getImageDir(),System.currentTimeMillis() + ".jpg");
        FileOutputStream fos = new FileOutputStream(file);
        boolean b = bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
        fos.flush();
        fos.close();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    finally {
        bitmap.recycle();
    }
}

截取的图片还是透明的。
您好,截图还是透明的,麻烦帮忙看一下,谢谢。
您好,您那边关闭openGL试试,environmentsetOpenGLmode(false);
谢谢您。现在可以获取范图片了,但是我添加的callout定位图标没出来。
callout定位没显示是在地图上不显示还是说生成的图片里面没有定位图标呢
生成的图片里面没有定位图标。

您好,您那边使用的imobile for Android的版本是多少呢,这个问题之前出现过,已经解决了的。您那边方便下载我们最新的产品包吗?下载地址:http://support.supermap.com.cn/DownloadCenter/DownloadPage.aspx?id=1155

您好,我们公司购买的好像是iMobile 8C的版本。您发的是10i,我们应该不能用吧?
...