Reputation: 2297
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
Upvotes: 7
Views: 7158
Reputation: 11
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));
}
Upvotes: 0
Reputation: 1960
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.
Upvotes: 1
Reputation: 6158
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
Upvotes: 2