标记图标内的Android Google Maps API字符串 [英] Android Google Maps API String inside the Marker Icon
本文介绍了标记图标内的Android Google Maps API字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有一种方法可以在Google Maps API 2.0中的 Marker
的图标中放入一个String值?
喜欢这张图片
以一种简单的方式。有点像这样:
map.addMarker(新的MarkerOptions()
.position(POSITION)
。 title(Your title)
.icon(这是我的VAR VAR STRING)
);
解决方案
您可以使用 Google Maps API实用程序库,并使用气泡图标自定义标记:
IconGenerator iconFactory = new IconGenerator(this);
MarkerOptions markerOptions = new MarkerOptions()。
图标(BitmapDescriptorFactory.fromBitmap(iconFactory.makeIcon(Your text)))。
头寸(新LatLng(-33.8696,151.2094))。
anchor(iconFactory.getAnchorU(),iconFactory.getAnchorV());
Is there a way I can put a value of a String inside the Marker
's icon on Google Maps API 2.0?
Like this image
in a simple way. Somewhat like this:
map.addMarker(new MarkerOptions()
.position(POSITION)
.title("Your title")
.icon(HERE PUT MY VAR STRING)
);
解决方案
You can use the Google Maps API Utility Library and customize you markers using bubble icons:
IconGenerator iconFactory = new IconGenerator(this);
MarkerOptions markerOptions = new MarkerOptions().
icon(BitmapDescriptorFactory.fromBitmap(iconFactory.makeIcon("Your text"))).
position(new LatLng(-33.8696, 151.2094)).
anchor(iconFactory.getAnchorU(), iconFactory.getAnchorV());
这篇关于标记图标内的Android Google Maps API字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文