Android 带有自定义标记的地图+;查看所有标记
嗨,伙计们,我公开了我的问题,但在我向你们展示我创建的代码之前,我将提供更多细节:Android 带有自定义标记的地图+;查看所有标记,android,Android,嗨,伙计们,我公开了我的问题,但在我向你们展示我创建的代码之前,我将提供更多细节: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState, R.layout.activity_map); GoogleMap map = ((SupportMapFragment) getSupportFrag
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState, R.layout.activity_map);
GoogleMap map = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
if (map != null) {
// Ciclo un mio ArrayList contenente contenuti con relative Latitudine e Longitudine
for (int i = 0; i < Contenuti.size(); i++) {
double lat = Double.parseDouble(Contenuti.get(i)
.getLatitude());
double lng = Double.parseDouble(Contenuti.get(i)
.getLongitude());
LatLng PUNTI = new LatLng(lat, lng);
String title = Contenuti.get(i).getName();
map.addMarker(new MarkerOptions()
.position(POI_POINT).title(title));
}
map.moveCamera(CameraUpdateFactory.newLatLngZoom(STARTING_POINT, 5));
map.animateCamera(CameraUpdateFactory.zoomTo(15), 2000, null);
}
}
我使用外部库universalimageloader来显示图像。它是有效的。。。但这不是我想要的,因为它们是应该产生这种效果的标记
提前感谢您的合作
我等待你的建议
private class CustomInfoWindowAdapter implements InfoWindowAdapter {
private View view;
public CustomInfoWindowAdapter() {
view = getLayoutInflater().inflate(R.layout.custom_pin, null);
}
@Override
public View getInfoContents(Marker marker) {
if (MapActivity.this.marker != null
&& MapActivity.this.marker.isInfoWindowShown()) {
MapActivity.this.marker.hideInfoWindow();
MapActivity.this.marker.showInfoWindow();
}
return null;
}
@Override
public View getInfoWindow(final Marker marker) {
MapActivity.this.marker = marker;
String url = null;
if (marker.getId() != null && markers != null && markers.size() > 0) {
if (markers.get(marker.getId()) != null
&& markers.get(marker.getId()) != null) {
url = markers.get(marker.getId());
}
}
final ImageView image = ((ImageView) view.findViewById(R.id.badge));
if (url != null && !url.equalsIgnoreCase("null")
&& !url.equalsIgnoreCase("")) {
ImageLoader.getInstance().displayImage(url, image);
} else {
image.setImageResource(R.drawable.ic_launcher);
}
return view;
}
}
private void initWidget() {
txtHeader = (TextView) findViewById(id.txtHeaderMenu);
if (Commons.categoriesList != null) {
txtHeader.setText(Commons.categoriesList.get(Commons.cat_id)
.getName());
}
}