从服务器获取数据并在地图上添加多个标记。 当我长时间点击标记时,新标记正在地图上创建相同的信息窗口并重复。 我不知道任何人都可以帮助我的问题
if(Points.size()>0)
{
for (int j = 0; j < staus.size(); j++) {
if (staus.get(j).equals("Run")) {
if (Vtype.get(j).equalsIgnoreCase("M/C")) {
marker = mMap.addMarker(new MarkerOptions()
.position(Points.get(j)).title(r_vn)
.snippet("").draggable(true)
.icon(BitmapDescriptorFactory.fromResource(R.drawable.mc_run)));
}
if (Vtype.get(j).equalsIgnoreCase("Car")) {
marker = mMap.addMarker(new MarkerOptions()
.position(Points.get(j)).title(r_vn)
.snippet("").draggable(true)
.icon(BitmapDescriptorFactory.fromResource(R.drawable.car_run)));
}
}
}
Log.i("livestatus la", String.valueOf(Points));
LatLngBounds.Builder builder = new LatLngBounds.Builder();
for (LatLng latLng : Points) {
builder.include(latLng);
if (Current_latlong != null) {
//builder.include(Current_latlong);
}
}
int width = getResources().getDisplayMetrics().widthPixels;
int height = getResources().getDisplayMetrics().heightPixels;
int padding = (int) (width * 0.10);
final LatLngBounds bounds = builder.build();
CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, width, height, padding);
mMap.animateCamera(cu);
}