@jimmithy Antwort gelöst meine Frage.
Dies ist nur ein dreistufiger Ausführung davon aus this project:
Schritt 1: Erstellen Sie das Layout Ihres infowindow. Hier ist popup.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:padding="2dip"
android:src="@drawable/ic_launcher"
android:contentDescription="@string/icon"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="25sp"
android:textStyle="bold"/>
<TextView
android:id="@+id/snippet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"/>
</LinearLayout>
</LinearLayout>
Schritt 2: Erstellen Sie Ihre Implementierung von InfoWindowAdapter. Hier ist PopupAdapter
Klasse:
class PopupAdapter implements InfoWindowAdapter {
LayoutInflater inflater=null;
PopupAdapter(LayoutInflater inflater) {
this.inflater=inflater;
}
@Override
public View getInfoWindow(Marker marker) {
return(null);
}
@Override
public View getInfoContents(Marker marker) {
View popup=inflater.inflate(R.layout.popup, null);
TextView tv=(TextView)popup.findViewById(R.id.title);
tv.setText(marker.getTitle());
tv=(TextView)popup.findViewById(R.id.snippet);
tv.setText(marker.getSnippet());
return(popup);
}
}
Schritt 3: in Ihrer Tätigkeit, stellen Sie Ihren Adapter an den GoogleMap:
mMap.setInfoWindowAdapter(new PopupAdapter(getLayoutInflater()));
Und Sie eingestellt sind!
Funktioniert perfekt. Vielen Dank! – iTurki
@iturki Das hat mein Problem nicht gelöst. Ich habe immer noch ein leeres Fenster, wenn ich Arabisch benutze. Was hast du genau gemacht, um das Problem zu lösen?> – AlAsiri
@AlAsiri Siehe meine Antwort. – iTurki