android 上未显示自定义标记图标
Custom markers icons not displayed on android
我有这个代码:
this.service.getListe(data).forEach((data: any) => {
const marker: Marker = this.map.addMarkerSync(data);
marker.on(GoogleMapsEvent.MARKER_CLICK).subscribe((params) => {
this.click(params);
});
});
现在 getListe()
看起来像:
getListe(merchants: any) {
const Liste: BaseArrayClass<any> = new BaseArrayClass<any>();
merchants.map(item => {
Liste.push({
title: item.name,
animation: 'DROP',
position: {
lat: item.lat,
lng: item.long
},
icon: 'http://icons.iconarchive.com/icons/iconarchive/red-orb-alphabet/24/Number-1-icon.png',
disableAutoPan: true
});
});
return Markers;
}
我试过并喜欢这个:
icon: {
url: 'http://icons.iconarchive.com/icons/iconarchive/red-orb-alphabet/24/Number-1-icon.png'
}
但同样的行为,问题是在模拟器和真实设备上图标没有改变。在浏览器模式下,我有我在 BaseArrayClass 中指示的正确图标作为标记,但在模拟器上我有默认图标。你知道吗?
尝试找一些使用https协议的图标。
Google 可能不允许不安全的 URL。
我有这个代码:
this.service.getListe(data).forEach((data: any) => {
const marker: Marker = this.map.addMarkerSync(data);
marker.on(GoogleMapsEvent.MARKER_CLICK).subscribe((params) => {
this.click(params);
});
});
现在 getListe()
看起来像:
getListe(merchants: any) {
const Liste: BaseArrayClass<any> = new BaseArrayClass<any>();
merchants.map(item => {
Liste.push({
title: item.name,
animation: 'DROP',
position: {
lat: item.lat,
lng: item.long
},
icon: 'http://icons.iconarchive.com/icons/iconarchive/red-orb-alphabet/24/Number-1-icon.png',
disableAutoPan: true
});
});
return Markers;
}
我试过并喜欢这个:
icon: {
url: 'http://icons.iconarchive.com/icons/iconarchive/red-orb-alphabet/24/Number-1-icon.png'
}
但同样的行为,问题是在模拟器和真实设备上图标没有改变。在浏览器模式下,我有我在 BaseArrayClass 中指示的正确图标作为标记,但在模拟器上我有默认图标。你知道吗?
尝试找一些使用https协议的图标。
Google 可能不允许不安全的 URL。