项目作者: jineshfrancs

项目描述 :
Utility class to make GoogleMap with custom theme.
高级语言: Java
项目地址: git://github.com/jineshfrancs/ThemedGoogleMap.git
创建时间: 2016-12-21T04:33:39Z
项目社区:https://github.com/jineshfrancs/ThemedGoogleMap

开源协议:Apache License 2.0

下载


ThemedGoogleMap

Utility class to make GoogleMap with custom theme.

Create your own theme like this

  1. GoogleMapStyler googleMapStyler = new GoogleMapStyler.Builder(MainActivity.this)
  2. .setMainGeometryColorRes(R.color.maingeometrycolor)
  3. .setAllPlaceTextStrokeAlpha(-80)
  4. .setAllPlaceTextColorRes(R.color.adminstartivelabel)
  5. .setAllMainTownTextColorRes(R.color.administativelocality)
  6. .setAllPoiTextColorRes(R.color.poitext)
  7. .setAllPoiParkBackgroundColorRes(R.color.poiparkbackground)
  8. .setAllPoiParkTextColorRes(R.color.poilabel)
  9. .setAllRoadBackgroundColorRes(R.color.roadbackground)
  10. .setAllRoadTextColorRes(R.color.roadlabel)
  11. .setAllRoadArterialBackgroundColorRes(R.color.roadarterialbackground)
  12. .setAllRoadArterialStrokeColorRes(R.color.roadarterialstroke)
  13. .setAllRoadHighwayBackgroundColorRes(R.color.roadhighway)
  14. .setAllRoadHighwayStrokeColorRes(R.color.roadhighwaystroke)
  15. .setAllRoadHighwayTextColorRes(R.color.roadhighwaylabel)
  16. .setAllRoadLocalBackgroundColorRes(R.color.roadlocal)
  17. .setAllRoadLocalStrokeColorRes(R.color.roadlocalstroke)
  18. .setAllTransitStationTextColorRes(R.color.transitstationtext)
  19. .setAllTransitBackgroundColorRes(R.color.transit)
  20. .setAllWaterTextColorRes(R.color.waterlabel)
  21. .setAllWaterBackgroundColorRes(R.color.water)
  22. .setAllWaterTextStrokeAlpha(-20)
  23. .build();
  24. // Alternatively to use a Color int, remove the Res from the method name
  25. // Example:
  26. // setMainGeometryColor(Color.BLACK)

Apply generated style to google map

  1. googleMap.setMapStyle(googleMapStyler.getMapStyleOptions());

Use in your project

1.Add it in your root build.gradle at the end of repositories:

  1. allprojects {
  2. repositories {
  3. ...
  4. maven { url 'https://jitpack.io' }
  5. }
  6. }

2.Add the dependency in your app build.gradle file:

  1. dependencies {
  2. compile 'com.github.jineshfrancs:ThemedGoogleMap:1.0'
  3. }