嗨我正在與谷歌地圖工作,我創建了一個自定義標題,我有標記,我需要知道什麼時候選擇標記我如何獲得標題的信息, becouse我需要打開一個片段與信息,letme粘貼你給我的代碼:獲取自定義標題標記信息穀歌地圖
@Override
public void onMapReady(GoogleMap googleMap) {
map =googleMap;
map.getUiSettings().setZoomControlsEnabled(true);
for (Taxi taxi : taxis) {
u= taxi.getUbicacionActual();
LatLng ubicacion= new LatLng(Double.parseDouble(u.getLatitud()), Double.parseDouble(u.getLongitud()));
map.moveCamera(CameraUpdateFactory.newLatLngZoom(ubicacion,15));
MarkerOptions punto= new MarkerOptions().position(ubicacion);
map.addMarker(punto);
map.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {
@Override
public View getInfoWindow(Marker marker) {
return null;
}
@Override
public View getInfoContents(Marker marker) {
View v = getLayoutInflater().inflate(R.layout.info_title, null);
TextView info1 = (TextView) v.findViewById(R.id.info1);
TextView info2 = (TextView) v.findViewById(R.id.info2);
TextView info3 = (TextView) v.findViewById(R.id.info3);
info1.setText("Fecha: " + u.getFecha());
info3.setText("Longitud: " + u.getLongitud().toString());
info2.setText("Ubicacion: "+obtenerDireccion(u.getLatitud(),u.getLongitud()));
return v;
}
});
}
map.setOnInfoWindowClickListener(new GoogleMap.OnInfoWindowClickListener() {
@Override
public void onInfoWindowClick(Marker marker) {
Fragment fragmento;
fragmento = new HistorialFragment();
getSupportFragmentManager().beginTransaction()
.replace(R.id.content_principal, fragmento)
.commit();
}
});
在方法OnInfoWindowClickListener,我稱之爲新的片斷,我需要從自定義標題發送信息,可能有人請幫助我呢?
非常感謝很多人現在工作:) –