【发布时间】:2014-08-11 10:00:36
【问题描述】:
Android:创建地图时 我得到了空白页面。我也有一个有效的 API 密钥并将其设置在清单中。 我的活动。
relativeLayout = new RelativeLayout(context);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
relativeLayout.setLayoutParams(layoutParams);
GoogleMapOptions googleMapOptions = new GoogleMapOptions();
googleMapOptions.mapType(GoogleMap.MAP_TYPE_NORMAL)
.compassEnabled(false).rotateGesturesEnabled(false)
.tiltGesturesEnabled(false);
googleMapOptions.camera(new CameraPosition(new LatLng(0, 0), 3, 0,
0));
mapView = new MapView(context, googleMapOptions);
mapView.onCreate(new Bundle());
relativeLayout.addView(mapView);
Double[][] latlang = mapData.getLatlang();
marker = new Marker[mapData.getLatlang().length];
for (int i = 0; i < mapData.getLatlang().length; i++) {
this.marker[i] = mapView.getMap()
.addMarker(
new MarkerOptions()
.position(
new LatLng(latlang[i][0],
latlang[i][1]))
.title(" ")
.snippet(" "));
}
【问题讨论】:
标签: android google-maps-api-3 android-maps-v2