我正在尝试在我的Gear S3 Frontier, Tizen 4.0
上显示Google地图。我得到以下输出:
我希望所有这些按钮(例如,卫星,放大和缩小等)都适合屏幕。
到目前为止,这是我的代码:
function initMap() {
var currPosition = {
lat: 33.6169854124275,
lng: 73.0656100279796
};
var mapProperties = {
// Start position
center: currPosition,
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var myMap = new google.maps.Map(document.getElementById("mapCanvas"), mapProperties);
var marker = new google.maps.Marker({
position: currPosition,
map: myMap
});
}
网络搜索显示了我绘制圆和多边形等的多种方法,但是我找不到将地图适合于圆形屏幕的任何方法
答案 0 :(得分:-1)
您可以在disableDefaultUI:true
中用MapOptions
删除它们
var mapProperties = {
// Start position
center: currPosition,
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDefaultUI:true
};
var myMap = new google.maps.Map(document.getElementById("mapCanvas"), mapProperties);
代码段:
function initMap() {
var currPosition = {
lat: 33.6169854124275,
lng: 73.0656100279796
};
var mapProperties = {
// Start position
center: currPosition,
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDefaultUI: true
};
var myMap = new google.maps.Map(document.getElementById("mapCanvas"), mapProperties);
var marker = new google.maps.Marker({
position: currPosition,
map: myMap
});
}
html,
body,
#mapCanvas {
height: 100%;
margin: 0;
padding: 0;
}
<div id="mapCanvas"></div>
<!-- Replace the value of the key parameter with your own API key. -->
<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk&callback=initMap">
</script>