你可以通过
JSON
String
有了样式:
@Override
public void onMapReady(GoogleMap map) {
try {
/* the inital styles to be applied */
String jsonString = this.getCurrentMapStyles();
MapStyleOptions style = new MapStyleOptions(jsonString);
boolean success = map.setMapStyle(style);
if (! success) {Log.e(TAG, "Style parsing failed.");}
} catch (Resources.NotFoundException e) {
Log.e(LOG_TAG, "Can't find style. Error: ", e);
}
/* start an update interval timer ... */
}
/* the styles, according to the current time */
private String getCurrentMapStyles() {
long timestamp = System.currentTimeMillis() / 1000;
String jsonString = "";
/* styles to be generated, with some values mutated */
return jsonString;
}
Style Reference