开发者

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 开发者_如何学C? Do I have to create different images for each screen sizes (ldpi, mdpi, hdpi) ?


  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.


While there's a default drawable for the user's position, there really isn't anything suitable in the default android drawables for an overlay item. There are plenty of icon packs with the Google Maps API in mind on Deviant Art and Smashing Magazine to give you a boost.

Regarding your question about size, it is always best practise to provide multiple versions of icons to support different screen sizes and densities--especially if your app will have wide distribution and target a wide range of API levels.

Alternately, if you're worried about the physical screen real estate that your drawables take up, but don't feel like doing a lot of resizing manually, you can scale all your drawables on the fly when you detect screen density, based on a common scaling .xml file:From the Android Doco

Personally, I take the path of least resistance and provide three versions of every drawable I produce. Up to you, mate!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜