dependencies {
compile 'com.google.maps.android:android-maps-utils:0.4+'
}
// want to use this
BubbleIconFactory bubbleIconFactory = new BubbleIconFactory(this);
IconGenerator iconGenerator = new IconGenerator(context);
// You can style icon using the IconGenerator.STYLE_BLUE
iconGenerator.setStyle(IconGenerator.STYLE_BLUE);
MarkerOptions markerOptions = new MarkerOptions()
.icon(BitmapDescriptorFactory.fromBitmap(iconGenerator.makeIcon("Your text here");))
.position(new LatLng(-33.8523341, 151.2106085)) // Sydney, Australia
.anchor(iconGenerator.getAnchorU(), iconGenerator.getAnchorV());
mMap.addMarker(markerOptions);
在Kotlin
val iconGenerator = IconGenerator(this)
// You can style icon using the IconGenerator.STYLE_BLUE
iconGenerator.setStyle(IconGenerator.STYLE_GREEN)
val markerOptions = MarkerOptions()
.icon(BitmapDescriptorFactory.fromBitmap(iconGenerator.makeIcon("Text here")))
.position(LatLng(-33.8523341, 151.2106085)) // Sydney, Australia
.anchor(iconGenerator.anchorU, iconGenerator.anchorV)
mMap.addMarker(markerOptions)
2条答案
按热度按时间5lwkijsr1#
BubbleIconFactory
已弃用。您可以改用IconGenerator
:Here您可以找到官方演示活动。
lb3vh1jj2#
BubbleIconFactory
在Java中被弃用。是的,正如@antonio提到的,使用IconGenerator
。依赖关系:
implementation 'com.google.maps.android:android-maps-utils:0.5'
在 java
在Kotlin