在谷歌地图V2添加多个标记 [英] Adding multiple markers on Google map V2

查看:145
本文介绍了在谷歌地图V2添加多个标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我正在开发中,我要显示的地图,并在地图上的一些标记小的android应用。我有latlang值列表,我想它显示在地图上。我在下面的方式尝试这样的:

 为(INT引脚= 0;销< pins.size();针++)
            {
                经纬度pinLocation =新的经纬度(Float.parseFloat(pins.get(PIN).latitude),Float.parseFloat(pins.get(PIN).longitude));
                标记storeMarker = map.addMarker(新的MarkerOptions()
                .POSITION(pinLocation)
                .title伪(pins.get(PIN).pinname)
                是.snippet(pins.get(PIN)。地址)
                );
            }

所以我的问题是,当我尝试上述方法,它只是显示上次标记不显示所有标记。如何做到这一点。需要帮忙。谢谢你。


解决方案

 为(INT引脚= 0;销< pins.size();针++)
                {
                    经纬度pinLocation =新的经纬度(Float.parseFloat(pins.get(PIN).latitude),Float.parseFloat(pins.get(PIN).longitude));
                    标记storeMarker = map.addMarker(新的MarkerOptions()
                    .POSITION(pinLocation) - GT;在这里,我已经做了一些修改补充pinLocation而不是storeLocation
                    .title伪(pins.get(PIN).pinname)
                    是.snippet(pins.get(PIN)。地址)
                    );
                }>之后pins.size的第一次检查大小()..

Hi I am developing small android application in which I want to display map and some markers on map. I have list of latlang values and i want to display it on map. I tried this in following way :

for(int pin=0; pin<pins.size(); pin++)
            {
                LatLng pinLocation = new LatLng(Float.parseFloat(pins.get(pin).latitude), Float.parseFloat(pins.get(pin).longitude));
                Marker storeMarker = map.addMarker(new MarkerOptions()
                .position(pinLocation)
                .title(pins.get(pin).pinname)
                .snippet(pins.get(pin).address)
                );
            }

So my problem is that when I try above method it just display last marker not showing all marker. How to do this. Need help. thank you.

解决方案

    for(int pin=0; pin<pins.size(); pin++)
                {
                    LatLng pinLocation = new LatLng(Float.parseFloat(pins.get(pin).latitude), Float.parseFloat(pins.get(pin).longitude));
                    Marker storeMarker = map.addMarker(new MarkerOptions()
                    .position(pinLocation )-->here i had made some changes add "pinLocation" instead of "storeLocation"
                    .title(pins.get(pin).pinname)
                    .snippet(pins.get(pin).address)
                    );
                }

> and after first check size of pins.size() ..

这篇关于在谷歌地图V2添加多个标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆