Hieveryone,一个问题。我像这样应用infowindows的背景:
android:background="#55000000"
但是它背后似乎总是有一个白色背景,有没有可能摆脱它?谢谢!
Hieveryone,一个问题。我像这样应用infowindows的背景:
android:background="#55000000"
但是它背后似乎总是有一个白色背景,有没有可能摆脱它?谢谢!
实现您自己的 InfoWindowAdapter 用于自定义设计 infoWindow
示例代码
private final View mWindow;
public MarkerAdapter() {
mWindow = getLayoutInflater().inflate(R.layout.custom_info_window,
null);
}
@Override
public View getInfoContents(Marker mark) {
return null;
}
@Override
public View getInfoWindow(Marker marker) {
render(marker, mWindow);
return mWindow;
}
private void render(Marker marker, View view) {
int badge;
// Use the equals() method on a Marker to check for equals. Do not
// use ==.
badge = R.drawable.ic_launcher;
((ImageView) view.findViewById(R.id.badge)).setImageResource(badge);
String title = marker.getTitle();
TextView titleUi = ((TextView) view.findViewById(R.id.title));
titleUi.setText(title);
String snippet = marker.getSnippet();
TextView snippetUi = ((TextView) view.findViewById(R.id.snippet));
snippetUi.setText(snippet);
}
}
然后将其称为
mMap.setInfoWindowAdapter(new MarkerAdapter());