#android #google_maps
У меня есть InfoWindow для маркеров.
Код:
public class MyCustomAdapterForItems implements GoogleMap.InfoWindowAdapter {
private final View myContentsView;
MyCustomAdapterForItems() {
myContentsView = getLayoutInflater().inflate(R.layout.my_item_info_window, null);
}
@Override
public View getInfoWindow(Marker marker) {
TextView tvName = ((TextView) myContentsView.findViewById(R.id.txtName));
TextView tvSity = ((TextView) myContentsView.findViewById(R.id.txtSity));
TextView tvAdress = ((TextView) myContentsView.findViewById(R.id.txtAdress));
TextView tvPhone = ((TextView) myContentsView.findViewById(R.id.txtPhone));
TextView tvBegin = ((TextView) myContentsView.findViewById(R.id.txtBegin));
TextView tvEnding = ((TextView) myContentsView.findViewById(R.id.txtEnding));
tvName.setText(clickedClusterItem.getName());
tvSity.setText(clickedClusterItem.getSity());
tvAdress.setText(clickedClusterItem.getAdress());
tvPhone.setText(clickedClusterItem.getPhone());
tvBegin.setText(clickedClusterItem.getBegin());
tvEnding.setText(clickedClusterItem.getEnding());
return myContentsView;
}
Часть InfoWindow скрывается за экраном. Вёрстка отступов в R.layout.my_item_info_window
не помогает. Что необходимо, чтоб окно было ниже ActionBar?
Ответы
Ответ 1
обично это делается так // получаем текуший latitude double latitude = location.getLatitude(); // получаем текуший longitude double longitude = location.getLongitude(); // Создает точку для карты LatLng latLng = new LatLng(latitude, longitude); now = googleMap.addMarker(new MarkerOptions().position(latLng))); // Переводим камеру на указанную точку googleMap.moveCamera(CameraUpdateFactory.newLatLng(latLng)); // Показываем нужным нам Zoom googleMap.animateCamera(CameraUpdateFactory.zoomTo(15)); А вам нужно уменшить longitude в зависимости Zoomа на несколько метров. Что бы камера карты центрировала не маркер а точку ниже координат маркера
Комментариев нет:
Отправить комментарий