0
ここで私のサンプルコードは2つのマーカーを追加しようとしています。私はGoogleマップに2つのマーカーを追加しています。私は2つのマーカーの異なるカスタム情報ウィンドウを表示する必要があります、どのように私はアンドロイドで行うことができますか?以下はGoogleマップに2つのマーカーを追加しています.2つのマーカーの異なるカスタム情報ウィンドウを表示する必要があります。どのようにすればいいですか?
その
mMap.addMarker(new MarkerOptions()
.position(position).title(v_nam)
.snippet(v_loc)
.icon(BitmapDescriptorFactory
.defaultMarker(BitmapDescriptorFactory.HUE_GREEN))).showInfoWindow();
mMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {
@Override
public View getInfoWindow(Marker marker) {
return null;
}
@Override
public View getInfoContents(Marker marker) {
View v = getLayoutInflater().inflate(R.layout.custom_info_contents, null);
String t1 = "<font color='#0000FF'> Vehicle :</font>";
String t2 = "<font color='#0000FF'> Vehicle Type :</font>";
String t4 = "<font color='#0000FF'> Speed :</font>";
String t5 = "<font color='#0000FF'> Location Address :</font>";
String t6 = "<font color='#0000FF'> Ignition :</font>";
String t7 = "<font color='#0000FF'> Live Date And Time :</font>";
TextView tvV = (TextView) v.findViewById(R.id.tv_vehicle);
tvV.setText(Html.fromHtml(t1 + v_nam));
TextView tvVT = (TextView) v.findViewById(R.id.tv_vehicletype);
tvVT.setText(Html.fromHtml(t2 + v_vt));
TextView tvDt = (TextView) v.findViewById(R.id.tv_dateandtime);
tvDt.setText(Html.fromHtml(t7 + v_ld));
TextView tvLoc = (TextView) v.findViewById(R.id.tv_location);
tvLoc.setText(Html.fromHtml(t5 + v_loc));
TextView tvSped = (TextView) v.findViewById(R.id.tv_direction);
tvSped.setText(Html.fromHtml(t4 + v_dir));
TextView tvign = (TextView) v.findViewById(R.id.tv_ignition);
tvign.setText(Html.fromHtml(t6 + v_ig));
return v;
}
});
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(position , 13.0f));
}
drawPolyLineOnMap(Points);
Log.i("history la", String.valueOf(Points));