Google maps 谷歌地图API的要求
当我尝试在我的应用程序中显示地图时,它会在视图中将消息显示为“Google maps API required”,这里是我的代码Google maps 谷歌地图API的要求,google-maps,extjs,cordova,sencha-touch-2,Google Maps,Extjs,Cordova,Sencha Touch 2,当我尝试在我的应用程序中显示地图时,它会在视图中将消息显示为“Google maps API required”,这里是我的代码 var mapapnel = Ext.create('Ext.Panel', { id: 'mapapnel', height: '100%', width: '100%', fullsc
var mapapnel = Ext.create('Ext.Panel', {
id: 'mapapnel',
height: '100%',
width: '100%',
fullscreen: true,
layout:'fit',
layout:'vbox',
items: [{
xtype: 'toolbar',
ui:'light',
docked: 'top',
title: 'Find location',
items: [{
text: 'Back',
ui: 'back',
handler: function() {
Ext.getCmp('homepnl').setActiveItem(1);
}
},{
xtype:'spacer'
}]},
{
xtype:'map',
useCurrentLocation:true
}]});
显示地图需要什么更改?请帮助我解决您需要加载google maps javascript api的问题 您可以通过在index.html文件中添加代码来实现这一点
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=true"></script>
两件事
1) 包含地图的面板应为卡片布局
2) 如果不设置中心地图选项,地图将不显示
根据需要提供纬度和液化天然气值
var mapapnel = Ext.create('Ext.Panel', {
id: 'mapapnel',
layout:'card',
items: [{
xtype: 'toolbar',
ui:'light',
docked: 'top',
title: 'Find location',
items: [{
text: 'Back',
ui: 'back',
handler: function() {
Ext.getCmp('homepnl').setActiveItem(1);
}
}
]},
{
xtype:'map',
useCurrentLocation:true,
mapOptions: {
zoom: 12,
zoomControl : true,
center: new google.maps.LatLng(Lat, Lng),
disableDefaultUI: true
}]
});
我已经在index.html中添加了。但是现在地图视图显示为空白屏幕,请看这个。。在div中包含地图并使用高度:100%Fazil,你能看到地图控件,即缩放按钮和平移按钮吗?@Rickert是的,我想使用缩放按钮地图正在显示,但无法放大或缩小。需要进一步做什么this@Fazil将缩放值设为0(共12),以实现全缩放功能。