Cordova / Phonegap Google地图插件上的标记图标的本地图片 [英] Local image for marker icon on Cordova/Phonegap Google Maps Plugin

查看:159
本文介绍了Cordova / Phonegap Google地图插件上的标记图标的本地图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用设备上本地存储的图像作为标记图标?我可以使用一个URL,它的工作原理,但当我尝试使用本地图像,它不会加载。我应该如何参考图像?这是一个多平台应用程序,因此我无法使用特定于设备的路径,例如Android file:/// android:asset /

Is it possible to use an image locally store on the device as the marker icon? I can use a URL and it works, but when I try to use a local image it won't load. How should I reference the image? This is a multiplatform application so I can't use device specific paths like Android file:///android:asset/

map.addMarker({
    'position': new plugin.google.maps.LatLng(13.7579507,100.5643353),
    'title': 'Fortune Town',
    'icon': '../templates/icon2.png'
}, function(marker) {
    marker.showInfoWindow();
});

我使用 Ionic Framework (使用 AngularJS )和 Apache Cordova Google地图插件https://github.com/wf9a5m75/phonegap-googlemaps-plugin/

推荐答案

它不会太多意义,但这是什么工作:

It doesn't make too much sense but this is what worked:

'icon': 'www/templates/icon2.png'

这篇关于Cordova / Phonegap Google地图插件上的标记图标的本地图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆