Ionic 2自定义标记不会从Android设备中的URL加载

时间:2022-11-18 17:01:31

Custom marker is not load showing in android device. In iOS is working. When I get a marker from secure sites (https://) then is worked. But I want to show from without secure site.

自定义标记未在Android设备中显示加载。在iOS工作。当我从安全站点(https://)获得标记时,就可以了。但是我希望在没有安全网站的情况下展示。

Add marker code for android

为android添加标记代码

Custom marker is not shown below code.

代码下方未显示自定义标记。

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 => {})

Custom marker is shown below code.

自定义标记显示在代码下方。

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 => {})     

here only marker url is change. i want to display marker from non secure domain in ionic 2. note: both demo is working in ios. please help me thanks

这里只有标记网址才会改变。我想在离子2中显示来自非安全域的标记。注意:两个demo都在ios中工作。请帮我谢谢

1 个解决方案

#1


0  

I tried to use tour icon-url in my code and it's working. I don't see too much difference between your code and mine, but you could try something like this.

我尝试在我的代码中使用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();
    });

#1


0  

I tried to use tour icon-url in my code and it's working. I don't see too much difference between your code and mine, but you could try something like this.

我尝试在我的代码中使用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();
    });