【发布时间】:2014-03-28 14:52:56
【问题描述】:
如何在 Android 的谷歌地图上插入图像标记选项
图1.1
http://i.stack.imgur.com/PNcEm.png
代码
try {
for(int i = 0; i < data.length(); i++){
JSONObject c = data.getJSONObject(i);
map = new HashMap<String, String>();
map.put("latitude", c.getString("poi_latitude"));
map.put("longitude", c.getString("poi_longitude"));
map.put("ImgPath", c.getString("images_path"));
map.put("ImgName", c.getString("images_name"));
MyArrList.add(map);
String Image = MyArrList.get(i).get("ImgPath" + "ImgName");
String Image1 = "<img src='" + Image + "'" + "width='42' height='42'>";
Spanned spannedContent = Html.fromHtml(Image1, getImageHTML(), null);
MarkerOptions markerOption = new MarkerOptions();
markerOption.title(MyArrList.get(i).get("name"));
//markerOption.icon(BitmapDescriptorFactory.fromBitmap(bitmap));
markerOption.snippet(spannedContent.toString());
LatLng latlng = new LatLng(Double.parseDouble(MyArrList.get(i).get("latitude")), Double.parseDouble(MyArrList.get(i).get("longitude")));
markerOption.position(latlng);
mMap.addMarker(markerOption);
}
帮帮我!!
【问题讨论】:
-
你可以检查这个 - stackoverflow.com/questions/14811579/… (Android Map api v2 Custom marker with ImageView) 并且有针对该问题的解决方案。