我在Android设备上看不到地图。
我已经为Android SDK创建了必要的API,并且我按照Stackoverflow帖子中指示的步骤操作:
https://ionic.tutorials24x7.com/blog/implement-google-maps-in-ionic-4-for-android
但是我还没有把它用到它并且它不会给我任何错误。
loadMap(){
this.map = GoogleMaps.create('map_canvas', {
camera: {
target: {
lat: 43.0741704,
lng: -89.3809802
},
zoom: 18,
tilt: 30
}
});
}
async onButtonClick(){
this.map.clear();
this.map.getMyLocation().then((location: MyLocation) => {
console.log(JSON.stringify(location, null ,2));
// Move the map camera to the location with animation
this.map.animateCamera({
target: location.latLng,
zoom: 17,
tilt: 30
});
// add a marker
let marker: Marker = this.map.addMarkerSync({
title: '@ionic-native/google-maps plugin!',
snippet: 'This plugin is awesome!',
position: location.latLng,
animation: GoogleMapsAnimation.BOUNCE
});
// show the infoWindow
marker.showInfoWindow();
// If clicked it, display the alert
marker.on(GoogleMapsEvent.MARKER_CLICK).subscribe(() => {
this._defaultService.mostrar_toast('clicked!', 2000);
});
})
.catch(err => {
this._defaultService.mostrar_toast(err.error_message, 2000);
});
}
如果你看到地图,如何运行'离子cordova运行浏览器',我想它可能是API的问题,但我不知道它是什么。
我刚刚解决了'ion-content有一个具有以下属性的类:
.container{
background-color: #eee;
background-image: url ('../ assets / imgs / fondo.jpg');
-webkit-background-size: cover;
-moz-background-size: cover;
background-repeat: no-repeat;
background-size: cover;
}
当我删除该课程时,虽然我不明白为什么,但它仍然有效