我们可以在我的位置蓝点上显示自定义信息窗口。 这是我的Map类。我通过扩展SupportMapFragment
创建了地图代码:
public class MapFragment extends SupportMapFragment {
GoogleMap mapView;
private Context context;
@Override
public void onCreate(Bundle arg0) {
super.onCreate(arg0);
}
@Override
public View onCreateView(LayoutInflater mInflater, ViewGroup arg1,
Bundle arg2) {
View view = super.onCreateView(mInflater, arg1, arg2);
setMapTransparent((ViewGroup) view);
return view;
}
答案 0 :(得分:0)
延伸
OnMarkerClickListener
在你班上。
并覆盖此功能
public boolean onMarkerClick(Marker arg0) {
// TODO Auto-generated method stub
arg0.showInfoWindow();
return true;
}
您可以使用
功能自定义信息窗口 mMap.setInfoWindowAdapter(new BalloonAdapter(getLayoutInflater()));
public class BalloonAdapter implements InfoWindowAdapter {
LayoutInflater inflater = null;
private TextView textViewTitle;
public BalloonAdapter(LayoutInflater inflater) {
this.inflater = inflater;
}
public View getInfoWindow(Marker marker) {
View v = inflater.inflate(R.layout.balloon, null);
if (marker != null) {
textViewTitle = (TextView) v.findViewById(R.id.textViewTitle);
textViewTitle.setText(marker.getTitle());
}
return (v);
}
public View getInfoContents(Marker marker) {
return (null);
}
}