Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android mapview marker size

I need to add custom markers to a mapview. First question : is there a standard/default overlay/marker that I can use ? Second : if I've to create a png for the marker overlay, which is the best size for the image ? Do I have to create different images for each screen sizes (ldpi, mdpi, hdpi) ?

like image 370
Arutha Avatar asked Sep 15 '11 08:09

Arutha


People also ask

What are Android markers?

Markers are objects of type Marker , and are added to the map with the GoogleMap. addMarker(markerOptions) method. Markers are designed to be interactive. They receive click events by default, and are often used with event listeners to bring up info windows.

How do I add a marker to Google Maps Android?

For adding a custom marker to Google Maps navigate to the app > res > drawable > Right-Click on it > New > Vector Assets and select the icon which we have to show on your Map. You can change the color according to our requirements. After creating this icon now we will move towards adding this marker to our Map.


1 Answers

  1. Extend ItemizedOverlay and use OverlayItem, where you can set you custom drawable via setMarker(drawable).
  2. Depends on your design. I personally used 32x32. You should give different sizes a try an see how they fit.
  3. Yes, this is preferable. You can use bitmap drawable, which can automatically resolve based on your screen size.
like image 172
Peter Knego Avatar answered Oct 06 '22 22:10

Peter Knego