如何在Google Maps Nativescript上显示我的位置 [英] How to display my location on Google Maps Nativescript

查看:115
本文介绍了如何在Google Maps Nativescript上显示我的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在此使用插件我的项目.

我想在地图上显示我的位置.在我读过的文件

I want to show my location in map. In document I read in

**UI Settings**
myLocationButtonEnabled boolean - Whether the my-location button is enabled/disabled

如何在代码中应用它?

我也尝试编写以下代码:

I try also to write this code:

  onMapReady(event) {
    this.mapView = event.object;
          var marker = new Marker();
          marker.position = Position.positionFromLatLng(-33.86, 151.20);
          marker.userData = { index: 1 };
          this.mapView.addMarker(marker);
          this.mapView.myLocationEnabled= true;   
  }

this.mapView.myLocationEnabled= true;不起作用.

您能建议我任何想法如何显示我的位置吗?

Can you suggest me any idea how to display my location please?

推荐答案

onMapReady(event) {
  this.mapView.gMap.setMyLocationEnabled(true);
}

我希望您缺少gMap

I hope you are missing gMap

这篇关于如何在Google Maps Nativescript上显示我的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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