1

In my application I have an Info Window on marker in the map, like the one in the image below.

example I would add a button or a checkbox inside the Info Window.

There's a way to add an input object inside the Info Window?

halfer
  • 19,824
  • 17
  • 99
  • 186
Jay
  • 145
  • 2
  • 12
  • look at this response in this post and try to do the same [custom windows layout marker](http://stackoverflow.com/a/15091202/2267302) – rojiTOCH Jun 20 '16 at 21:38

2 Answers2

1

There's a way to add an input object inside the Info Window?

No. The info window is a bitmap. It happens to be a bitmap created from a layout file, but it is still a bitmap. You are welcome to put an interactive widget in the info window layout, but it will not react to user input.

You can detect when the user taps on an info window and display some popup that contains interactive widgets (e.g., a dialog).

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
0

You have to hide normal infowindow, then on marker click show your own window, maybe an AlertDialog with your layout.

remember to return true; to hide normal infowindow

GoogleMap.OnMarkerClickListener onMarkerClickListener = new GoogleMap.OnMarkerClickListener(){

            @Override
            public boolean onMarkerClick(Marker marker) {
              //open your window

         //For Example
        final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setMessage("Hey ive done my infowindow").setTitle("My own infowindow");
        builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id)
                dialog.dismiss();
            }
        });
        AlertDialog dialog = builder.create();
        dialog.show();

             return true; //RETURNING TRUE going to hide normal infowindow

        }
        };
        googleMap.setOnMarkerClickListener(onMarkerClickListener);
Cunity
  • 181
  • 1
  • 8