7

I have created a custom map styling following this tutorial

https://www.youtube.com/watch?v=sLZxAB1el6w

The issue i am facing now is that i want to display the Map in 2D view rather than the earth 3D view by default i don't want to enable compass using which i believe you can switch between 2 views.

It would be really helpful if you could share any information regarding this.

Thanks

Gaurav Sarma
  • 2,248
  • 2
  • 24
  • 45

3 Answers3

2

As far as I know, there is no option to restrict as only 2D view in just one option.

However you can change the settings like this.

GoogleMapOptions options = new GoogleMapOptions();
options.compassEnabled(false);
options.tiltGesturesEnabled(false);
options.rotateGesturesEnabled(false);

MapView mapView = new MapView(context, options);
mapView.getMapAsync(new OnMapReadyCallback() {
  @Override
  public void onMapReady(GoogleMap map) {

  }
});

More options, check out the document https://developers.google.com/android/reference/com/google/android/gms/maps/GoogleMapOptions

wf9a5m75
  • 6,100
  • 3
  • 25
  • 59
1

I think what your looking for is the MapType:

@Override
public void onMapReady(GoogleMap map) {
    mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
}

From the api docs :

public static final int MAP_TYPE_HYBRID

Satellite maps with a transparent layer of major streets.

public static final int MAP_TYPE_NONE

No base map tiles.

public static final int MAP_TYPE_NORMAL

Basic maps.

public static final int MAP_TYPE_SATELLITE

Satellite maps with no labels.

public static final int MAP_TYPE_TERRAIN

Terrain maps.

Hope this helps.

Hristo Stoyanov
  • 1,960
  • 1
  • 12
  • 24
0

For your google map instance, use animateCamera method and fix the tilt to 0 degree for CameraBuilder instance.

public void onMapReady(GoogleMap googleMap) {
    CameraPosition cameraPosition = new 
    CameraPosition.Builder().target(your_lat_long).zoom(16).tilt(0).build();

    googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
Zoe
  • 27,060
  • 21
  • 118
  • 148