0

I'm trying to create an app similar to Waze but I don't know how to make a pop up menu for markers like this

The system I'm trying do is that if a user decides to mark their current location or double tap anywhere on the map a menu will pop up with a selection of my own markers. I'm using the latest version of Google Maps for Android and iOS

1 Answers1

1

You can customize the pop up with an Adapter, just call the setInfoWindowAdapter method and override the following methods, like this:

mGoogleMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {
            @Override
            public View getInfoWindow(Marker arg0) {
                return null;
            }

            @Override
            public View getInfoContents(Marker marker) {
                LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                View rowView = inflater.inflate(R.layout.item_marker_location, null);
                TextView tvTitle   = (TextView) rowView.findViewById(R.id.tvMarkerTitle);
                TextView tvSnippet = (TextView) rowView.findViewById(R.id.tvMarkerSnippet);
                tvTitle.setText(marker.getTitle());
                tvSnippet.setText(marker.getSnippet());
                return rowView;
            }
        });

You can read the documentation of the InfoWindowAdapter interface.

Raúl Omaña
  • 883
  • 6
  • 10