Die Breite, die ich in meinem benutzerdefinierten InfoWindow-Layout festgelegt habe, scheint ignoriert zu werden (es ist immer match_parent).Breite meines benutzerdefinierten InfoWindow-Layouts wird in Google Maps Android API v2 ignoriert
Fehle ich etwas?
mMap.setInfoWindowAdapter(new InfoWindowAdapter() {
@Override
public View getInfoWindow(Marker arg0) {
return null;
}
@Override
public View getInfoContents(Marker arg0) {
View v = getActivity().getLayoutInflater().inflate(R.layout.info_window_layout, null);
// set my custom data
return v;
}
});
info_window_layout.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="100dp"
android:layout_height="50dp"
android:padding="5dp" >
<!-- some custom stuff -->
</RelativeLayout>
Offensichtlich ist dies nur ein Problem mit RelativeLayouts ist. LinearLayouts funktionieren gut. Also habe ich mein Layout in ein LinearLayout umgeschrieben. Glücklicherweise war es ziemlich einfach und so war es kein großes Problem. – Ridcully