我需要在我的应用程序上显示世界地图。我尝试使用 MapView 并设置 liteMode= true 和 zoomLevel=1 但它没有按我的需要工作。liteMode也不支持groundOverlay,我需要在WorldMap上显示多个groundOverlay。任何人都可以知道吗?
请参考下面的链接,我需要像这样显示完整的世界地图。
https://upload.wikimedia.org/wikipedia/commons/b/b0/World_location_map_%28equirectangular_180%29.svg
下面我完成的代码:
<com.google.android.gms.maps.MapView
android:id="@id/mapView"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_180"
map:liteMode="true"
map:cameraZoom="1"
map:mapType="normal"
/>
在我的 Java 类中
@Override
public void onMapReady(GoogleMap googleMap) {
if (googleMap != null) {
this.googleMap = googleMap;
this.googleMap.getUiSettings().setCompassEnabled(false);
this.googleMap.getUiSettings().setAllGesturesEnabled(false);
this.googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
this.googleMap.setMapStyle(MapStyleOptions.loadRawResourceStyle(getContext(), R.raw.style_json));
this.googleMap.getUiSettings().setMapToolbarEnabled(false);
this.googleMap.getUiSettings().setCompassEnabled(false);
this.googleMap.getUiSettings().setScrollGesturesEnabled(false);
}
在此添加了 zoomLevel=1 但在谷歌地图中它没有显示世界地图,就像我分享的上面的图片链接一样。