0
我試圖將自定義信息窗口設置爲Android中的特定標記。假設我有兩種類型的標記,我只想讓自定義信息窗口發生在一個或一組標記上,但不是地圖上的所有標記。如何將自定義標記窗口設置爲特定標記
到目前爲止,我已經嘗試了基本功能,爲標記創建了自定義佈局,並調用了map.setInfoWindowAdapter()
。
googleMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {
@Override
public View getInfoWindow(Marker marker) {
return null;
}
@Override
public View getInfoContents(Marker marker) {
View v = getActivity().getLayoutInflater().inflate(R.layout.marker, null);
TextView info= (TextView) v.findViewById(R.id.info);
info.setText(marker.getPosition().toString());
return v;
}
});
它會影響所有正在顯示的標記。有沒有辦法指定一個標記?