Harita üzerinde işaretçiler oluşturdum. Onlara tıkladığımda, özel bilgi pencereleri her zaman ekran kadar geniş.Google Haritalar'da özel InfoWindow genişliğini ayarla api v2
layout_width="200dp"
'u ayarlamayı denedim, ancak bu yardımcı olmadı. Ben de snippetUi.setWidth(GetDipsFromPixel(200));
ayarlayarak TextView'lar genişliğini ayarlayabilirsiniz ama düzen hala geniş ekran kalır
view.setLayoutParams(new LayoutParams(GetDipsFromPixel(200), GetDipsFromPixel(300)));
ayarlama çalıştı.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#FFFFFF"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:padding="10dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#FFFFFF"
android:gravity="center_vertical">
<ImageView
android:id="@+id/worldmap_infowindow_profileimg"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/noimage" />
<TextView
android:id="@+id/worldmap_infowindow_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="To do No.2."
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="bold"
android:paddingLeft="5dp"/>
</LinearLayout>
<View android:id="@+id/separator"
android:background="#ababab"
android:layout_width = "fill_parent"
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
android:layout_height="1dp"/>
<TextView
android:id="@+id/worldmap_infowindow_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="See the Giza Pyramids"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/worldmap_infowindow_details"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="It was fascinating! It's a shame that it was raining, though."
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="normal" />
</LinearLayout>
Sınıf:
private class CustomInfoWindowAdapter implements InfoWindowAdapter {
private View view;
public CustomInfoWindowAdapter() {
view = getLayoutInflater().inflate(R.layout.custom_infowindow, null);
}
@Override
public View getInfoContents(Marker marker) {
if (WorldMap.this.myMarker != null
&& WorldMap.this.myMarker.isInfoWindowShown()) {
WorldMap.this.myMarker.hideInfoWindow();
WorldMap.this.myMarker.showInfoWindow();
}
return null;
}
@Override
public View getInfoWindow(final Marker marker) {
WorldMap.this.myMarker = marker;
final String title = marker.getTitle();
final TextView titleUi = ((TextView) view.findViewById(R.id.worldmap_infowindow_name));
if (title != null) {
titleUi.setText(title);
} else {
titleUi.setText("");
}
final String snippet = marker.getSnippet();
final TextView snippetUi = ((TextView) view.findViewById(R.id.worldmap_infowindow_details));
if (snippet != null) {
snippetUi.setText(snippet);
} else {
snippetUi.setText("");
}
return view;
}
}
bu yardımcı olacaktır etsin u http : //stackoverflow.com/questions/16711522/how-to-change-the-custom-infowidnow-shape-of-the-google-maps-api-v2/16712599#16712599 @erdomester – TheFlash
Yardım aldı, teşekkürler. Ben sadece 'android: background = "@ drawable/bg_custominfowindow" 'u ekledim. Burada bg_custominfowindow, xml'de oluşturulmuş bir şekil. Lütfen bunu bir çözüm olarak ekleyin. – erdomester
harika yardımcı oldu ... Kısa açıklama ile cevap ekleyeceğim. – TheFlash