我在项目中使用了plugin。
我想在地图上显示我的位置。在我读过的文件
中**UI Settings**
myLocationButtonEnabled boolean - Whether the my-location button is enabled/disabled
如何在代码中应用它?
我也尝试编写以下代码:
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;
不起作用。
您能建议我任何想法如何显示我的位置吗?
答案 0 :(得分:0)
ReadMe file中已经对此进行了描述,
您可以在mapReady之后通过更改 mapView.settings
上的以下属性来调整Map UI设置myLocationButtonEnabled布尔值-my-location按钮是否为 启用/禁用
代码应为
this.mapView.settings.myLocationButtonEnabled = true;
按照demo app中的说明,在启用位置按钮之前,请确保您已获取位置权限。
答案 1 :(得分:0)
onMapReady(event) {
this.mapView.gMap.setMyLocationEnabled(true);
}
我希望您缺少gMap