0
我正在使用Google Maps V2。我试图在运行时使用来自服务器的图像和文本创建自定义标记。我想有一个像标记一样的气球,它会根据图像位图的大小以及文本的大小来展开。Android - 动态自定义地图标记
例如:
可以说我有一个像这样的气球像:
像这样的图片:
我所试图实现将这个图像放置在气球内部,图像上方有一些文字,例如:
如果可能的话,我怎么能做到这一点?
我有最终的图像将作为在谷歌地图标记选项,像这样的东西图标:
// Resource ID from the drawable folder
int balloon_id = getResources().getInteger(R.drawable.balloon_image);
// A bitmap image that came from the server (I got this done)
Bitmap image_from_server;
// Some text that came from the server (I got this done too)
String some_text;
// A method that will return the final resulted image to be placed to the marker options
// What I need is to find out the work out of this method (This is where I am struggling
BitmapDescriptor result_image = some_method(balloon_id, image_from_server, some_text);
// Marker Options for the custom marker
MarkerOptions mo = new MarkerOptions()
.position(latlng)
.icon(result_image);
// Then I can have my marker
Marker my_marker = google_map.addMarker(mo);
我特地到StackOverflow上的无果类似的解决方案。接受的答案将包含我正在努力构建的方法,或者是我可以自己实现解决方案的一个非常好的方向(但请查看我的方法的参数以及返回结果,如果需要调整这不是一个大问题),提前感谢!