Styling Google Maps on Android

I think I know the answer to this question, but can we create Google Map v2? By style, I mean using the Google Maps API Map Mapping Wizard ( http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html ), which can be used to pull JSON style data for JavaScript API

Google seems to have pulled it for Ingress, so it hopes there is a way. I cannot find a way, so I suspect that Google is using internal knowledge for Ingress. Does anyone know for sure?

+4
source share
5 answers

To create your map, call GoogleMap.setMapStyle () , passing in a MapStyleOptions object containing style declarations in JSON format. You can load JSON from a raw resource or line in the mapReady () function ... so after declaring it json, calling your map ready function will almost look like

@Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; try { // Customise the styling of the base map using a JSON object defined // in a raw resource file. boolean success = mMap.setMapStyle( MapStyleOptions.loadRawResourceStyle( this, R.raw.style_json)); if (!success) { Log.e("MapsActivityRaw", "Style parsing failed."); } } catch (Resources.NotFoundException e) { Log.e("MapsActivityRaw", "Can't find style.", e); } } 

Define the source resource in / res / raw / style _json.json containing the JSON style declaration for night mode

You can get json from the following link https://mapstyle.withgoogle.com/

+10
source

Yes, now you can declare a Json object to create a ur map with the GoogleMap.setMapStyle() function. Check documents .

+7
source

According to the recommendations of the Google developer, Geo Mano Marks Ingress does not use Google Maps and at the moment, unlike the Javascript API, the Android API (via Google Play Services) does not support stylized maps, although it does support names (see TilesProvider, etc. .).

I hope that soon they will bring their stylized maps to the Android application (Google Play).

+6
source

Google has just released a new API for creating Google maps: https://developers.google.com/maps/documentation/android-api/styling

+2
source

According to official Google documentation: https://developers.google.com/maps/documentation/android-api/lite

The Google Maps Android API does not support custom styles.

-3
source

Source: https://habr.com/ru/post/1494108/


All Articles