0

我需要在我的应用程序上显示世界地图。我尝试使用 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 但在谷歌地图中它没有显示世界地图,就像我分享的上面的图片链接一样。

4

2 回答 2

0

在您的活动的onMapReady中设置 Google 地图的样式。

googleMap.setMapStyle(MapStyleOptions.loadRawResourceStyle(getActivity(), R.raw.customized_map_style));

您需要下载样式。请通过以下链接 https://developers.google.com/maps/documentation/android-sdk/styling

根据需要更新样式。

于 2019-05-10T13:09:56.233 回答
0
CameraPosition cameraPosition = new CameraPosition.Builder().
                    target(YourLocationPoint).
                    tilt(60).
                    zoom(15).
                    bearing(0).
                    build();

myMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));

您可以使用倾斜和方位来实现相同的文档

于 2019-05-10T10:06:37.627 回答