Question

can we show a custom info window over a my location blue dot. This is my Map class.I have created the map by extending SupportMapFragment

code :

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;
}
Was it helpful?

Solution

Extend on

 OnMarkerClickListener

in your class.

and override this function

    public boolean onMarkerClick(Marker arg0) {
            // TODO Auto-generated method stub

            arg0.showInfoWindow();
            return true;
        }

you can customize the infowindow by using the function

 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);
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top