Reputation: 1134
1) Can I use different custom markers?
I´d need one for the user´s location and one for every other Item.
Edit: Yes you can.
2) Can I add an Image into a marker?
I´d need to assign a different Image (which I would get from a DB) for every marker, is this possible? Do I need to create a custom Layout for this?
3) Where is the marker centered on the map? (~Graphical question)
Basically, where does the marker need to point to? Like the red one to the center, or like the blue one?
Upvotes: 1
Views: 2513
Reputation: 3137
As you found out - yes, you can have custom markers. Each OverlayItem can return its own marker via getMarker().
I'm not exactly sure what you're asking. If you are asking whether you can pull an icon from a database and use that as the custom marker, then the answer is yes. You can extend OverlayItem and override getMarker to return whatever Drawable you want on-the-fly. Remember that OverlayItem and ItemizedIconOverlay are just starting points - real functionality comes from extending them with your own logic. Also remember that doing DB work on the main thread (which is where getDrawable() will be called) is not a good idea.
Take a look at the Hotspot functionality in OverlayItem. This controls what part of the icon will be centered on the location. So for the red marker, the Hotspot would be BOTTOM_CENTER, whereas the blue marker would be TOP_CENTER.
Upvotes: 4