Área en la que se puede hacer clic en el marcador de mapa de Google

Estoy usando este ejemplo: https://github.com/galex/android-mapviewballoons

My problem is that the clickable area is wider than the marker itself. For example, my Google Map marker is 25x25 then the clickable area would extend up to 70x70. This is a big problem for overlapping markers.enter image description here

When I clicked on the tip of that arrow, onTap is activated, even though the tap area is far from the marker.

Por favor, ayúdame. Gracias.

preguntado el 08 de noviembre de 11 a las 09:11

did you ever solve this problem? -

in HTML version I only see such issue with custom marker images, not with the default one -

2 Respuestas

This is the default behaivior of ItemizedOverlay. 25x25 px is generally not an adquate touchable area for most human fingers.

Deberías anular el hitTest() method if you want to modify the way an overlay item hit is tested.

respondido 08 nov., 11:13

Can you give example of hit test? - jatin

For debugging :

Intente usar un TouchDelegate for the View, you can specify the Touch rect for a give View

An example showing how to use the TouchDelegate :

public class TouchDelegateSample extends Activity { 
  Button mButton; 
  protected void onCreate(Bundle savedInstanceState) { 
    mButton = (Button)findViewById(R.id.delegated_button); 
    View parent = findViewById(R.id.touch_delegate_root); 
    // post a runnable to the parent view's message queue so its run 
    // the view is drawn 
    parent.post(new Runnable() { 
      public void run() { 
        Rect delegateArea = new Rect(); 
        Button delegate = TouchDelegateSample.this.mButton; 
        delegateArea.top -= 200; 
        TouchDelegate expandedArea = new TouchDelegate(delegateArea, 
        // give the delegate to an ancestor of the view we're 
delegating the 
        // area to 
        if (View.class.isInstance(delegate.getParent())) { 


See if a given hit point is within the bounds of an item's marker. Override to modify the way an item is hit tested. The hit point is relative to the marker's bounds. The default implementation just checks to see if the hit point is within the touchable bounds of the marker.

respondido 08 nov., 11:21

For debugging can you call View.getHitRect(). I think it will be helpful - Reno

Thanks for the reply.. the marker is not a View, it's an overlayitem. Kindly check MyItemizedOverlay.java. Thanks. - Jayson Tamayo

MyItemizedOverlayItem Se extiende BalloonItemizedOverlay, this is where you override hitTest () - Reno

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.