自定义标记未在Android设备中显示加载。在iOS工作。 当我从安全站点(https://)获得标记时,就可以了。但我想在没有安全网站的情况下展示。
为Android添加标记代码
自定义标记未显示在代码下方。
let icon: GoogleMapsMarkerIcon = {
url: 'http://und.edu/_files/images/cta-homepage-visit.png',
size: {
width: 50,
height: 50
}
};
let markerOptions: GoogleMapsMarkerOptions = {
position: location,
draggable: false,
icon: icon
};
this.map.addMarker(markerOptions)
.then((marker: GoogleMapsMarker) => {
}).catch(err => {})
自定义标记显示在代码下方。
let icon: GoogleMapsMarkerIcon = {
url: 'https://lh4.ggpht.com/Tr5sntMif9qOPrKV_UVl7K8A_V3xQDgA7Sw_qweLUFlg76d_vGFA7q1xIKZ6IcmeGqg=w300',
size: {
width: 50,
height: 50
}
};
let markerOptions: GoogleMapsMarkerOptions = {
position: location,
draggable: false,
icon: icon
};
this.map.addMarker(markerOptions)
.then((marker: GoogleMapsMarker) => {
}).catch(err => {})
这里只有标记网址才会发生变化。我想在离子2中显示来自非安全域的标记。 注意:这两个演示都在ios中运行。 请帮我 感谢
答案 0 :(得分:0)
我尝试在我的代码中使用tour icon-url并且它正常工作。我不会在你的代码和我的代码之间看到太多差异,但你可以尝试这样的东西。
let markerOptions: GoogleMapsMarkerOptions = {
position: latLong,
title: data.name,
visible: true,
icon: {
'url': "http://und.edu/_files/images/cta-homepage-visit.png",
'anchor': [18, 36],
'size': {
width: 36,
height: 36
}
}
};
this.map.addMarker(markerOptions)
.then((marker: GoogleMapsMarker) => {
marker.hideInfoWindow();
});