tags:

views:

55

answers:

1

Hey-

I'm having some trouble getting a hold of the drawable a certain OverlayItem is using so I can calculate the height of it and properly offset the note that shows onTap. Here is my code to try to get that drawable:

Drawable marker = item.getMarker(android.R.attr.state_focused);
if (marker != null) int markerHeight = marker.getIntrinsicHeight();

marker ends up null.

I'm using a drawable XML file with a selector for the different states of the OverlayItem's drawable. In it I'm specifying a drawable for the null state, state_focused, and state_pressed.

Thanks for any help!

-Nick

+1  A: 

According to the documentation about getMarker:

Returns the marker that should be used when drawing this item on the map. A null value means that the default marker should be drawn.

Therefore all you need to do is to pre-calculate the height of the default marker, store it somewhere and return it in case null is returned.

I have also find this discussion about OverlayItem and ItemizedOverlay useful.

kgiannakakis
Word. Thanks for that!
Bloudermilk